6
我想使用WCF 4來設置一個REST風格的Web服務。我希望可以使用HTTP和HTTPS訪問該服務。如何設置HTTP和HTTPS WCF 4 RESTful服務?
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior>
<webHttp helpEnabled="true" />
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add scheme="http" binding="webHttpBinding" />
</protocolMapping>
</system.serviceModel>
然後我就可以通過稍微改變配置來此開啓HTTPS的服務:默認情況下,該服務具有以下配置,其適用於HTTP,但沒有使用https創建
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior>
<webHttp helpEnabled="true" />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding >
<binding name="SecureWebBinding" >
<security mode="Transport"></security>
</binding>
</webHttpBinding>
</bindings>
<protocolMapping>
<add scheme="http" binding="webHttpBinding" bindingConfiguration="SecureWebBinding"/>
</protocolMapping>
</system.serviceModel>
我問題是我如何才能使用這兩種服務?
我想它應該是** https **://ww.xyz.com/MyService.svc爲您的示例中首先定義的端點。 –