【问题标题】:Is an exported SSL cert required for a client of a WCF application?WCF 应用程序的客户端是否需要导出的 SSL 证书?
【发布时间】:2014-04-21 19:23:01
【问题描述】:

我有一个仅为传输安全配置的 WCF 应用程序。托管该应用程序的 Web 服务器已为该应用程序安装了 SSL 证书。

客户正在构建自己的客户端来使用 WCF 服务。他们的开发团队坚持要求我向他们提供 SSL 证书,以便他们安装。

这对我来说没有意义。为什么他们需要我导出我的证书并将其提供给他们?有了传输安全性,它不就像浏览器那样工作,连接只是通过 HTTPS,而不需要在客户端上进行额外的工作吗?

在我告诉他们他们错之前,我想确保我是对的。

【问题讨论】:

  • 我同意。只要您使用的是官方认可的证书,他们就应该能够使用浏览器(假设您允许)浏览您的服务,并像往常一样直接从安全警告页面安装证书的公共部分。跨度>

标签: wcf wcf-security


【解决方案1】:

我为该场景创建了一个示例应用程序,消费客户端不需要包含证书(使用类似于以下的配置)

仅具有传输安全性的 WCF 服务

绑定

<wsHttpBinding>
    <binding name="wsHttpBindingConfiguration" receiveTimeout="00:10:00"  sendTimeout="10.00:00:00" maxBufferPoolSize="1073741824" maxReceivedMessageSize="1073741824">
      <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
      <security mode="Transport">
        <transport clientCredentialType="None"></transport>
      </security>
    </binding>
 </wsHttpBinding>

服务端点的配置

<service behaviorConfiguration="noClientCertBehavior" name="WCFCallbackTry.Service1">
    <endpoint address="https://machineName:8056/Service1.svc" bindingConfiguration="wsHttpBindingConfiguration" binding="wsHttpBinding"
      contract="WCFCallbackTry.IService" name="HttpsEndPoint" />
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="https://machineName:8056/Service1.svc"/>
      </baseAddresses>
    </host>
 </service>

服务行为

<behavior name="noClientCertBehavior">
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceMetadata httpsGetEnabled="true"/>
      <serviceCredentials>
        <serviceCertificate findValue="9d4c41cde9d2b82d751a1234fd2eb6df98d3b576" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/>
      </serviceCredentials>
</behavior>

客户

绑定和端点

<system.serviceModel>
<bindings>
  <wsHttpBinding>
    <binding name="HttpsEndPoint">
      <security mode="Transport">
        <transport clientCredentialType="None" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<client>
  <endpoint address="https://machineName:8056/Service1.svc" binding="wsHttpBinding"
    bindingConfiguration="HttpsEndPoint" contract="ServiceReference1.IService"
    name="HttpsEndPoint" />
</client>

有关不同配置的更多信息,另请参阅link

注意:客户端和服务位于同一台机器上

【讨论】:

  • 好酷。你的样本对我来说很有意义,这就是我的想法。谢谢。
猜你喜欢
  • 2021-07-01
  • 1970-01-01
  • 2015-01-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-11-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多