2013-03-14 98 views
2

我寫了wcf服務服務器和客戶端應用程序,客戶端和服務器都可以很好地使用基本的http綁定。 現在我想更改配置以使用SSL進行連接。 有沒有可以解釋我是如何可以舉個例子吧WCF SSL連接配置?

非常感謝

回答

3

這裏任何物體都是一個非常好的一篇關於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