我創建了一個Web服務,爲此我嘗試爲3個端點提供不同的綁定。 1. basicHttpBinding的, 2的wsHttpBinding, 3的WebHttpBindingWebHttpBinding未到達客戶端
當我做了服務的參考,我只得到創建與basicHttpBinding的端點和綁定的wsHttpBinding。我沒有得到webHttpBinding。可能有什麼錯誤。
下面是web.config中serviceModel節點的結構。
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"/>
</diagnostics>
<services>
<service behaviorConfiguration="VersionTolerance.Service1Behavior" name="BookShop.BookShopService">
<endpoint address="sadha" binding="basicHttpBinding" contract="BookShop.IBookShopService" />
<endpoint address="ws" binding="wsHttpBinding" contract="BookShop.IBookShopService" >
</endpoint>
<endpoint address="web" binding="webHttpBinding" behaviorConfiguration="webHttpBehavior"
contract="BookShop.IBookShopService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:49654/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="VersionTolerance.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttpBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
謝謝@marc_s,我想同意你的回答。但我想通過創建一個客戶端來體驗webHttpBinding。 用外行人的話說,我應該怎麼做才能在Visual Studio中爲這個服務創建一個代理並開始使用它? – SaravananArumugam 2011-01-19 18:01:26