它是一种绝大多数平台都能支持的简单text-based协议;另一种是元数据交换终结点

时间:2021-08-06 07:48:06

颁布处事元数据的方法有两种:一是基于HTTP-GET协议供给元数据,它是一种绝大大都平台都能撑持的简单text-based协议;另一种是元数据交换终结点。

1.基于HTTP-GET协议

<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <services> <service behaviorConfiguration="metaExchange"> <host> <baseAddresses> <add baseAddress="http://localhost:8000/MyService"/> </baseAddresses> </host> <endpoint address="HelloWCFService" binding="wsHttpBinding" contract="HelloWCFService.IHelloWCFService"/> <!--<endpoint address="metaExchange" binding="mexHttpBinding" contract="IMetadataExchange"/>--> </service> </services> <behaviors> <serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="true"/> <!--<serviceMetadata/>--> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>

2.元数据交换终结点

<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <services> <service behaviorConfiguration="metaExchange"> <host> <baseAddresses> <add baseAddress="http://localhost:8000/MyService"/> </baseAddresses> </host> <endpoint address="HelloWCFService" binding="wsHttpBinding" contract="HelloWCFService.IHelloWCFService"/> <endpoint address="metaExchange" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior> <!--<serviceMetadata httpGetEnabled="true"/>--> <serviceMetadata/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>