我有一个仅为传输安全性配置的WCF应用程序。托管该应用程序的Web服务器已为该应用程序安装了SSL证书。
客户正在构建自己的客户端以使用WCF服务。他们的开发团队坚持要求他们为他们提供安装在他们身边的SSL证书。
这对我没有意义。他们为什么要我出口我的证书并提供给他们?有了传输安全性,它不像浏览器一样工作,连接只是通过HTTPS进行,而无需在客户端进行额外的工作吗?
在我告诉他们他们错了之前,我想确保我是对的。
答案 0 :(得分:1)
我为场景创建了一个示例应用程序,并且消费客户端没有必要包含证书(使用类似于以下的配置)
<强>绑定强>
<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
注意:客户端和服务驻留在同一台计算机上