IMetadataExchange 接口
定义
公开用于返回有关服务的元数据的方法。Exposes methods used to return metadata about a service.
public interface class IMetadataExchange
[System.ServiceModel.ServiceContract(ConfigurationName="IMetadataExchange", Name="IMetadataExchange", Namespace="http://schemas.microsoft.com/2006/04/mex")]
public interface IMetadataExchange
[<System.ServiceModel.ServiceContract(ConfigurationName="IMetadataExchange", Name="IMetadataExchange", Namespace="http://schemas.microsoft.com/2006/04/mex")>]
type IMetadataExchange = interface
Public Interface IMetadataExchange
- 属性
注解
Windows Communication Foundation (WCF) services 进行编程时,发布有关服务的元数据会很有用。When programming Windows Communication Foundation (WCF) services, it is useful to publish metadata about the service. 例如,元数据可以是描述某服务使用的所有方法和数据类型的 Web Services 描述语言 (WSDL) 文档。For example, metadata can be a Web Services Description Language (WSDL) document that describes all of the methods and data types employed by a service. 返回有关 WCF 服务的元数据,服务的使用者可以轻松创建服务的客户端。Returning metadata about an WCF service allows consumers of a service to easily create clients for the service. 有关 WCF 元数据终结点的详细信息,请参阅 元数据。For more information about WCF metadata endpoints, see Metadata.
使用 WCF 实现的服务通过公开一个或多个元数据终结点来发布元数据。Services implemented using WCF publish metadata by exposing one or more metadata endpoints. WCF 中的元数据终结点的地址、绑定和协定与其他任何终结点类似。Metadata endpoints in WCF have an address, a binding and a contract like any other endpoint. MetadataReference接口指定 WCF 中所有元数据终结点实现的服务协定。The MetadataReference interface specifies the service contract implemented by all metadata endpoints in WCF.
不需要在您的服务实现中实现 MetadataReference。There is no need to implement the MetadataReference contract in your service implementation. 相反,请将 ServiceMetadataBehavior 添加到服务说明。Instead, add the ServiceMetadataBehavior to the service description.
或者,在使用配置时,将终结点元素的 contract 属性设置为 IMetadataExchange。Or, when using configuration, set the contract attribute of the endpoint element to IMetadataExchange. 有关示例,请参阅 如何:使用配置文件发布服务的元数据。For an example, see How to: Publish Metadata for a Service Using a Configuration File.
有关在 WCF 中发布元数据的详细信息,请参阅 发布元数据。For details on publishing metadata in WCF see Publishing Metadata.
方法
| BeginGet(Message, AsyncCallback, Object) |
开始元数据的异步检索。Starts an asynchronous retrieval of metadata. |
| EndGet(IAsyncResult) |
指示元数据的检索。Concludes the retrieval of metadata. |
| Get(Message) |
返回服务元数据。Returns the service metadata. |