wcf研究小结

来源:互联网 发布:外国文献翻译软件 编辑:程序博客网 时间:2024/05/16 07:58

 

1、生成证书(目前为可用语句,具体参数还需要细细研究,这里面很深啊~)

makecert -r -pe -n CN="MyWebServer" -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localmachine -sky exchange

 -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12

 

2、config配置

<endpoint address ="" binding="wsHttpBinding" contract="WcfService.IService1" bindingConfiguration="EndpointBinding">
          <!--
              部署时,应删除或替换下列标识元素,以反映
              在其下运行部署服务的标识。删除之后,WCF 将
              自动推导相应标识。
          -->
          <identity>
            <dns value="MyWebServer"/>
          </identity>
        </endpoint>

<bindings>
      <wsHttpBinding>
        <binding name="EndpointBinding">
          <security mode="Message">
            <transport clientCredentialType="Windows" proxyCredentialType="Windows"/>
            <message clientCredentialType="UserName"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>

 

 

<serviceCredentials>
            <serviceCertificate findValue="MyWebServer"
                                 x509FindType="FindBySubjectName"
                                 storeLocation="LocalMachine"
                                 storeName="My"/>
            <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WcfService.Models.CustomUserPassword,WcfService" />
          </serviceCredentials>

同颜色的需要一致才能触发用户验证

 

详细情况还不清晰,先记录下

原创粉丝点击