Var denne side nyttig?
Din feedback på dette indhold er vigtigt. Giv os din mening.
Mere feedback?
1500 tegn tilbage
Eksportér (0) Udskriv
Udvid alt
Dette indhold er ikke tilgængeligt på dit sprog, men her er den engelske version.

How to: Expose a Metadata Endpoint

Updated: May 18, 2015

A Service Bus metadata endpoint is a URI that exposes additional information about a service or client application. For example, the Svcutil.exe tool uses the exposed metadata from a service to build a contract so that a developer can access that service. Without the metadata, the developer would have to gain access to the contract in some other way, such as asking the creator for a copy of it directly via e-mail. Note that you can still implement an interface without metadata: metadata enables you to easily obtain the contract if you do not already have it. Also note that exposing a metadata endpoint differs from publishing your interface to the ATOM feed: the metadata endpoint contains additional information about the contract, whereas publishing on the ATOM feed just lists the service URI in a publicly-accessed database.

The following is a simplified procedure for exposing metadata on an application that uses Service Bus. For a complete discussion of metadata, see Metadata Architecture Overview in the Windows Communication Foundation (WCF) documentation.

  1. In the App.config file for the host application, add the metadata endpoint definition to the service configuration information.

      <service name="Service.EchoService">
        <endpoint name="RelayEndpoint"
                  ... />
        <endpoint name="MexEndpoint" contract="IMetadataExchange" binding="netTcpRelayBinding" bindingConfiguration="default" address="mex" />
  2. To add metadata publishing to the service, modify the application configuration information to include an additional behaviors section.

        <serviceBehaviors><behavior name="serviceMetadata"><serviceMetadata /></behavior></serviceBehaviors>
  3. Add the metadata behavior to the service by specifying the behaviorConfiguration property in the service definition.

      <service name="Service.EchoService" behaviorConfiguration="serviceMetadata">
    If the metadata endpoint is specified with a different end-to-end security mode than the service endpoint, and uses a relative address while sharing the same base address with the service endpoint, an exception of type System.ArgumentException is thrown when you open the service host. The following error message accompanies the exception: Incompatible channel listener settings. To resolve this issue, perform one of the following workarounds:

    • Specify the address of the metadata endpoint as a fully-qualified address.

    • If you want to use a relative address for the metadata endpoint that shares a base address with the service endpoint, specify the same end-to-end security mode for both the metadata and service endpoints.

    • Use a relative address for the metadata endpoint with a base address that differs from the base address of the service endpoint.

© 2015 Microsoft