在我的WCF服务中,我尝试通过SSL连接使用JSON将数据发送到客户端。我能够使用安全模式为Transport的wsHttpBinding为我的客户机保护OData数据库源。为什么webHttpBinding不能为了使用SSL而做同样的事情?如何配置需要使用JSON才能使用SSL连接的端点呢?
从本质上讲,webHttpBinding和wsHttpBinding的区别是什么?
<bindings>
<wsHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="EndpBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="ServiceBehavior" name="DataService4.DataService">
<endpoint address="" binding="webHttpBinding" contract="DataService4.IService" bindingConfiguration="TransportSecurity" behaviorConfiguration="EndpBehavior" />
<endpoint contract="IMetadataExchange" binding="mexHttpsBinding" address="mex" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
发布于 2013-10-01 01:07:41
我想这篇文章会解决你的问题。Creating a WCF RESTful Service And Secure It Using HTTPS Over SSL
发布于 2016-05-04 04:05:09
来自http://www.allenconway.net/2012/05/creating-wcf-restful-service-and-secure.html的相关部分如下:
<bindings>
<webHttpBinding>
<binding>
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings> 而且如果需要,还可以移除暴露的元数据。
有关详细信息,请参阅msdn:https://msdn.microsoft.com/en-us/library/bb924478(v=vs.110).aspx
相关部分包括:
传输安全是使用HTTPS提供的。服务需要配置SSL证书。消息完全使用HTTPS进行保护,并且服务由客户端使用服务的SSL证书进行身份验证。客户端身份验证是通过transport of webHttpBinding的ClientCredentialType属性控制的。
https://stackoverflow.com/questions/19096480
复制相似问题