C# WCF SSL连接配置?

C# WCF SSL连接配置?,c#,wcf,ssl-certificate,C#,Wcf,Ssl Certificate,我编写了wcf服务服务器和客户端应用程序,客户端和服务器都能很好地使用基本http绑定。 现在我想更改配置以使用SSL进行连接。 有没有人能解释我该如何解释并举例说明 非常感谢这是一篇非常好的文章,内容是关于和 该密钥将位于Config文件中 <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicSecure">

我编写了wcf服务服务器和客户端应用程序,客户端和服务器都能很好地使用基本http绑定。 现在我想更改配置以使用SSL进行连接。 有没有人能解释我该如何解释并举例说明


非常感谢

这是一篇非常好的文章,内容是关于和

该密钥将位于
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
默认启用了此加密

祝你好运。

这是在WCF服务上使用SSL的一个非常简单和基本的参考。 不久前,我和你在同一条船上,关于SO的第一个问题是关于HTTP/HTTPS绑定。我和其中一个用户进行了很好的讨论,他们给了我一个很好的想法 看看这个。我有web配置,它是配置的主要工具

希望这有帮助。

刚刚设置的
帮了我的忙,谢谢!