標籤:mode 發布 oca add blog fse point sea ext
發布服務中繼資料的方式有兩種:一是基於HTTP-GET協議提供中繼資料,它是一種絕大多數平台都能支援的簡單text-based協議;另一種是中繼資料交換終結點。
1.基於HTTP-GET協議
<?xml version="1.0" encoding="utf-8" ?><configuration> <system.serviceModel> <services> <service name="HelloWCFService.HelloWCFService" 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 name="metaExchange"> <serviceMetadata httpGetEnabled="true"/> <!--<serviceMetadata/>--> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel></configuration>
2.中繼資料交換終結點
<?xml version="1.0" encoding="utf-8" ?><configuration> <system.serviceModel> <services> <service name="HelloWCFService.HelloWCFService" 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 name="metaExchange"> <!--<serviceMetadata httpGetEnabled="true"/>--> <serviceMetadata/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel></configuration>
C# WCF發布服務的中繼資料的方式