如何将WCF json绑定到具有多个绑定的https?

时间:2013-08-13 15:40:21

标签: asp.net wcf web-services

我正在使用WCF将webservices绑定到SOAP和JSON。我必须在生产中运行ssl。我已将soap地址绑定到https,但我无法弄清楚如何将JSON地址绑定到https。这是我的配置。

<protocolMapping>
  <add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
  <service name="EnterpriseServices.Service.AuthorizationServiceBase">
    <endpoint address="soap" binding="basicHttpBinding" contract="EnterpriseServices.Contracts.Authorization.IAuthorizationManagerBase" />
    <endpoint address="soap" binding="basicHttpsBinding" contract="EnterpriseServices.Contracts.Authorization.IAuthorizationManagerBase" />
    <endpoint address="json" binding="webHttpBinding" behaviorConfiguration="jsonBehavior" contract="EnterpriseServices.Contracts.Authorization.IAuthorizationManagerBase" />
  </service>
...

我是否可以为我的“json”端点添加一个protocolMapping,我可以用它绑定到https?

1 个答案:

答案 0 :(得分:2)

您是否在绑定中将安全模式设置为传输?

<webHttpBinding>
  <binding name="jsonpSsl">
     <security mode="Transport" />
  </binding>
</webHttpBinding>

查看此答案:WCF service with JSONP over SSL