如何让WCF服务通过SSL运行?
我正在IIS6中运行一个C#web服务,并试图通过SSL使它工作。当做一个tcpdump时,它显示最初的呼叫为https,但通过http进行其他呼叫。我的SSL证书是自签名的,在我的网页浏览器中https正常工作。我为客户端使用PHP SoapClient。如何让WCF服务通过SSL运行?
有谁知道这会导致什么?
在wsdl中,地址位置设置为http。这应该是https吗?我该如何改变它?
<wsdl:service name="Service">
<wsdl:port name="BasicHttpBinding_Service" binding="i0:BasicHttpBinding_Service">
<soap:address location="http://example.com/Service.svc"/>
</wsdl:port>
</wsdl:service>
您必须配置服务使用HTTPS:
<bindings>
<basicHttpBinding>
<binding name="https">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="metadata">
<serviceMetadata httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="..." behaviorConfiguration="metadata">
<endpoint address="..." contract="..." binding="basicHttpBinding"
bindingConfiguration="https" />
</service>
</services>
这将只允许通过HTTPS调用你的服务,因为没有暴露任何不安全的端点。 WSDL也只能通过HTTPS访问,因为HTTP GET未启用。
没有人回复OP的另一个问题:在wsdl中,地址位置设置为http。这应该是https吗?我该如何改变它?请让我知道,如果上述更改配置文件也更改地址位置为https?是否需要某些东西? – WinFXGuy 2012-11-23 17:06:15
@WinFXGuy:WSDL中的地址位置也应该是HTTPS。如果它不是你有一些额外的配置问题。 – 2012-11-23 18:00:17
我错过了什么?请参考我的问题:http://stackoverflow.com/questions/13502185/why-my-wsdl-still-shows-basic-http-binding-with-the-location-value-of-http – WinFXGuy 2012-11-23 18:25:48
WCF服务或ASMX服务? – 2011-04-27 23:36:21
这是一个WCF服务 – Eggo 2011-04-28 00:15:31
差别很大。将来你应该说哪个。 “.NET C#Web服务”不明确。 – 2011-04-28 00:51:37