我正在尝试让第三方 Java 客户端与我编写的 WCF 服务进行通信。
收到消息时出现以下异常:
无法找到令牌验证器
“System.IdentityModel.Tokens.UserNameSecurityToken”令牌类型。代币
根据当前的安全性,该类型不能被接受
设置。
这是我的配置:
Binding
<customBinding>
<binding name="TestSecureBinding">
<security authenticationMode="MutualCertificate" />
<textMessageEncoding messageVersion="Soap11WSAddressing10" />
<httpsTransport requireClientCertificate="true" maxReceivedMessageSize="5242880" />
</binding>
</customBinding>
行为:
<serviceBehaviors>
<behavior name="TestCertificateBehavior">
<serviceCredentials>
<clientCertificate>
<certificate storeLocation="LocalMachine" x509FindType="FindBySubjectName" findValue="Test 01"/>
<authentication certificateValidationMode="PeerTrust" trustedStoreLocation="LocalMachine" revocationMode="NoCheck"/>
</clientCertificate>
<serviceCertificate storeLocation="LocalMachine" x509FindType="FindBySubjectName" findValue="Test 01"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
端点:
<service name="TestService"
behaviorConfiguration="TestCertificateBehavior">
<endpoint
name="TestEndpoint"
address="https://localhost:443"
contract="TestServiceContract"
binding="customBinding"
bindingConfiguration="TestSecureBinding">
</endpoint>
<host>
<baseAddresses>
<add baseAddress="https://localhost:443" />
</baseAddresses>
</host>
</service>
有谁知道是什么原因造成的?
这是因为在某处使用了引用证书的错误方式,如果我没记错的话,您可以直接引用证书或使用密钥标识符 - 无论如何,为了超越它,您应该能够将allowSerializedSigningTokenOnReply标记添加到您的安全性中标记您的客户端绑定配置并将其设置为 true。
that should为你超越它 - 记住,把这个客户端
抱歉,我找不到参考资料 - 我记得在某个地方读过它,但现在找不到了! :( ****编辑这里是**** -http://webservices20.blogspot.co.uk/2010/10/wcf-cannot-find-token-authenticator.html
<customBinding>
<binding name="TestSecureBinding">
<security allowSerializedSigningTokenOnReply="true" />
etc
</binding>
<customBinding>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)