如何为支持AJAX的WCF服务同时启用HTTP和HTTPS?
以下是我的配置设置,目前只允许HTTP:如何为支持AJAX的WCF服务同时启用HTTP和HTTPS?,ajax,wcf,https,Ajax,Wcf,Https,以下是我的配置设置,目前只允许HTTP: <system.serviceModel> <services> <service name="MyAjaxSvc"> <endpoint address="" behaviorConfiguration="MyAjaxSvcEndpointBehavior" binding="webHttpBinding" contract="MyAjax
<system.serviceModel>
<services>
<service name="MyAjaxSvc">
<endpoint address="" behaviorConfiguration="MyAjaxSvcEndpointBehavior"
binding="webHttpBinding"
contract="MyAjaxSvc" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="MyAjaxSvcEndpointBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
此服务可能会在我网站的任何页面上调用。有些页面是HTTPS,所以我想对其进行设置,以便可以使用任一协议调用AJAX服务。理想情况下,我希望我所有的AJAX服务调用都是HTTPS,但由于您不能混合协议,我将满足于允许使用当前页面使用的任何协议来调用服务。在黑暗中拍摄:
您需要在通常显示的代码上方添加另一个声明的绑定,然后声明另一个端点。非常好。我将第二次绑定的安全模式设置为“传输”,这一切都起了作用。谢谢