C# 使用配置vs代码验证客户端证书,错误“消息中至少有一个安全令牌无法验证”
我正在尝试验证随https请求发送到我的web服务的证书是否与服务器的受信任人员存储中的特定证书匹配 客户端正在使用私钥对其soap消息进行签名,我正在尝试使用它们提供的公钥进行验证 如果我改变:C# 使用配置vs代码验证客户端证书,错误“消息中至少有一个安全令牌无法验证”,c#,wcf,web-services,validation,ssl,C#,Wcf,Web Services,Validation,Ssl,我正在尝试验证随https请求发送到我的web服务的证书是否与服务器的受信任人员存储中的特定证书匹配 客户端正在使用私钥对其soap消息进行签名,我正在尝试使用它们提供的公钥进行验证 如果我改变: <clientCertificate> <authentication certificateValidationMode="None" /> </clientCertificate> 我的测试客户端配置: <behaviors> <en
<clientCertificate>
<authentication certificateValidationMode="None" />
</clientCertificate>
我的测试客户端配置:
<behaviors>
<endpointBehaviors>
<behavior name="testCertBehavior">
<clientCredentials>
<clientCertificate findValue="*.myPrivateCert" storeLocation="LocalMachine" storeName="TrustedPeople" x509FindType="FindBySubjectName"/>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<binding name="BasicHttpBinding_Test" sendTimeout="00:03:00"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="Certificate"/>
</security>
</binding>
<endpoint address="https://test.com/Service.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Test"
contract="Test.Services.TestService" name="EndPoint_BasicHttpBinding_Test"
behaviorConfiguration="testCertBehavior" />
添加服务引用后,客户端配置是什么样子的?我已经编辑了您的标题。请看,如果一致意见是否定的,他们就不应该。@scheien我不确定我的客户机的实际配置是什么样子的,但这是我的客户机设置用于测试,问题已更新。@JohnSaunders谢谢,尽管我只是想让标题更有意义,并且在标题中看到了许多引用WCF的其他问题。没有大问题,但大多数读者在寻找WCF问题时会使用标签,而不是标题。这是一个分离关注点的东西-标题应该是数据,而不是元数据。
<behaviors>
<endpointBehaviors>
<behavior name="testCertBehavior">
<clientCredentials>
<clientCertificate findValue="*.myPrivateCert" storeLocation="LocalMachine" storeName="TrustedPeople" x509FindType="FindBySubjectName"/>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<binding name="BasicHttpBinding_Test" sendTimeout="00:03:00"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="Certificate"/>
</security>
</binding>
<endpoint address="https://test.com/Service.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Test"
contract="Test.Services.TestService" name="EndPoint_BasicHttpBinding_Test"
behaviorConfiguration="testCertBehavior" />