WCF客户端配置中是否需要证书编码值?

WCF客户端配置中是否需要证书编码值?,wcf,security,Wcf,Security,我已将安全模式设置为消息的WCF服务: <security mode="Message"> <message clientCredentialType="UserName" negotiateServiceCredential="true" establishSecurityContext="true" algorithmSuite="Default" /> </security> ... <

我已将安全模式设置为消息的WCF服务:

<security mode="Message">
   <message 
      clientCredentialType="UserName" 
      negotiateServiceCredential="true" 
      establishSecurityContext="true" 
      algorithmSuite="Default" />
</security>
...
<behaviors>
  <serviceBehaviors>
      ...
      <serviceCredentials>
        <serviceCertificate findValue="my Certifiacate ..."/>
      </serviceCredentials>

...
...
服务证书在服务行为部分给出

当VS创建客户端(.NET)(通过添加服务引用)时,它会在web.config中创建
元素


我发现即使此部分为空,客户端也可以成功连接服务。我猜客户端使用服务证书的编码值来加密消息。但当配置中未指定编码值时,它也可以工作吗?那么这是为了什么呢?

它只在您在wcf配置中指定要在绑定中使用加密时进行加密

<wsHttpBinding>
  <binding>
    <security mode="Message">
      <transport clientCredentialType="Windows" proxyCredentialType="None"
       realm="" />
      <message clientCredentialType="Certificate" negotiateServiceCredential="true"
       algorithmSuite="TripleDesSha256Rsa15" establishSecurityContext="true" />
     </security>
   </binding>
</wsHttpBindings>


奇怪的是,我只能说,当服务器证书丢失时,我们在回答中使用类似配置的服务会失败。@U ajp您误读了我的问题。我是说,当客户端配置部分为空时,它会工作。我的意思是说,缺少服务器证书配置的客户端将失败。您是否获得negotiateServiceCredential=“true”?我猜这会使服务器证书被发送到客户端的情况有所不同。