我目前正在使用带有 Windows 身份验证的 netTcpBinding(用 C# 编写的程序)。我将放弃域身份验证(添加不在域中的新客户端),并希望通过用户名/通行证身份验证设置证书安全性。从我到目前为止所读到的内容来看,我不一定需要客户端证书(这很好;我无法在每个客户端上安装服务的证书)。我的想法与使用受信任的 CA 颁发的证书导航到安全网站是一样的;它承认自己是受信任的,不会提出任何问题或造成任何麻烦,它只是接受证书!
到目前为止,我已经设置了服务证书(我们有来自 GoDaddy 的通配符证书),但是我不知道必须对 app.config 文件进行哪些更改才能不需要客户端证书.
服务应用程序配置:
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode="None" revocationMode="NoCheck" />
</clientCertificate>
<serviceCertificate findValue="*.xxxxxx.com"
storeLocation="LocalMachine"
storeName="TrustedPublisher"
x509FindType="FindBySubjectName" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
客户端应用程序配置:
<security mode="Transport">
<transport clientCredentialType="Certificate" protectionLevel="EncryptAndSign" />
<message clientCredentialType="UserName" />
</security>
我知道我必须为用户名部分设置一个自定义验证器,但我认为一次一步。谢谢,如果您需要更多详细信息,请告诉我。
最佳答案
将 clientCredentialType 更改为 None。也在服务器配置上执行此操作。
关于c# - 仅使用服务的 WCF 证书身份验证(无客户端证书),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10386003/