1、编写一个简单的wcf服务,使用wshttpbinding。主要配置如下:
<bindings>
<wsHttpBinding>
<binding name="NewBinding0">
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="WcfServiceHost.Service1Behavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceCredentials>
<clientCertificate>
<authentication customCertificateValidatorType="LoginServiceLibrary.CustomX509CertificateValidator,LoginServiceLibrary"
certificateValidationMode="Custom" />
</clientCertificate>
<serviceCertificate findValue="10.18.5.102" x509FindType="FindBySubjectName" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
2、在IIS上配出一个需要客户端证书的目录(用https可以访问到服务)
我想在LoginServiceLibrary.CustomX509CertificateValidator 类中验证客户端证书,实验中该类就是不起作用。
请各位高手不吝赐教,在下感激不尽。