WCF SSL连接配置?

问题描述:

我写了wcf服务服务器和客户端应用程序,客户端和服务器都可以很好地使用基本的http绑定。 现在我想更改配置以使用SSL进行连接。 有没有可以解释我是如何可以举个例子吧WCF SSL连接配置?

非常感谢

这里任何物体都是一个非常好的一篇关于just thatnice post on Stack here

该密钥将在您的Config文件中。

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="BasicSecure"> 
      <security mode="Transport" /> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <services> 
     <service name="WcfServiceLibrary.Echo.EchoService"> 
     <endpoint 
      address="https://localhost:8888/EchoService/" 
      binding="basicHttpBinding" 
      bindingConfiguration="BasicSecure" 
      contract="WcfServiceLibrary.Echo.IEchoService"> 
      <identity> 
      <certificateReference 
       storeName="My" 
       storeLocation="LocalMachine" 
       x509FindType="FindByThumbprint" 
       findValue="f1b47a5781837112b4848e61de340e4270b8ca06" /> 
      </identity> 
     </endpoint> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:8080/" /> 
      </baseAddresses> 
     </host> 
     </service> 
    </services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name=""> 
     <serviceMetadata httpGetEnabled="true"/> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
    </system.serviceModel> 

他们的事情,这里要注意,是security mode = "Transport"CertificateReference。这些将是非常非常重要的。您必须确保您的端口已正确配置才能正常工作。

也请记住,wshttpBinding默认情况下启用了此加密。

祝你好运。

+0

只需设置''为我做了窍门,谢谢! – 2013-09-27 08:01:12

http://www.codeproject.com/Articles/36705/7-simple-steps-to-enable-HTTPS-on-WCF-WsHttp-bindi 这是在WCF Serice上使用SSL的一个非常简单和基本的参考。 我刚才和你在同一条船上,我的第一个问题是关于HTTP/HTTPS绑定。我和SO上的一位用户进行了很好的讨论,他们给了我一个关于这个问题的好主意 看看这个。我有网络配置这是主要的配置 HTTP and HTTPS Bindings

希望这有助于。