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为您的示例中首先定义的端点。 –