none
wsDualHttpBinding 客户端无法在配置的超时(00:00:00)之内完成安全协商。当前的协商段为 1(00:00:00) RRS feed

  • 问题

  • 服务端配置

    <?xml version="1.0" encoding="utf-8"?> <configuration> <connectionStrings> <add name="PublishSubscribeConnectionString" connectionString="Data Source=192.168.10.2;Initial Catalog=PublishSubscribe;User ID=sa;Password=Server2012" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <bindings> <wsDualHttpBinding> <binding name="myWsDualHttpBinding"> <security > <message clientCredentialType="UserName" /> </security> </binding> </wsDualHttpBinding> </bindings> <services> <service name="PublishSubscribeService2.Service1" behaviorConfiguration="myBehavior"> <endpoint binding="wsDualHttpBinding" bindingConfiguration="myWsDualHttpBinding" contract="PublishSubscribeService2.IService1"></endpoint> </service> </services> <behaviors> <serviceBehaviors> <behavior> <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false 并删除上面的元数据终结点 --> <serviceMetadata httpGetEnabled="true"/> <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 --> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> <behavior name="myBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> <serviceCredentials> <serviceCertificate x509FindType="FindBySubjectName" findValue="WCF" storeLocation="LocalMachine" storeName="My" /> <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="PublishSubscribeService2.UserNamePassWord,PublishSubscribeService2" /> <clientCertificate> <authentication certificateValidationMode="None"/> </clientCertificate> </serviceCredentials> <serviceAuthorization > <authorizationPolicies> </authorizationPolicies> </serviceAuthorization> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> <protocolMapping> <add scheme="http" binding="wsDualHttpBinding" /> </protocolMapping> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> </configuration>

    客户端配置

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <system.serviceModel>
            <!--<bindings>
                <wsDualHttpBinding>
                    <binding name="WSDualHttpBinding_IService1">
                        <security>
                            <message clientCredentialType="UserName" />
                        </security>
                    </binding>
                </wsDualHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://localhost:17317/Service1.svc" behaviorConfiguration="clientBehavior"
                    binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IService1"
                    contract="ServiceReference1.IService1" name="WSDualHttpBinding_IService1">
                    <identity>
                        <certificate encodedValue="AwAAAAEAAAAUAAAAIIe5tiyfSJPKm4GjdJUn6l/7ztMgAAAAAQAAAOABAAAwggHcMIIBSaADAgECAhAzWaptutONiUseq7uB3VEAMAkGBSsOAwIdBQAwDjEMMAoGA1UEAxMDV0NGMB4XDTE0MTExNTAxMjg1OVoXDTM5MTIzMTIzNTk1OVowDjEMMAoGA1UEAxMDV0NGMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCxFi3Bd1IXEXLmWy/GeL4uRc30vL/rI3jS2l6vL7QfIXWZ13T/YdMGcf249Wp0BKqGz7+6qPyp8JwdQ6grAQV2CYKdKh2RmHb6iMi7TIHz0Fx6sZqRPBzilU+DwP1YNb6z2yi8gZTqap9eA4KivHtgvqvyFsfD/fYXQeBfzG6S7wIDAQABo0MwQTA/BgNVHQEEODA2gBApFHDL3/35GpRV7D+3Oa8YoRAwDjEMMAoGA1UEAxMDV0NGghAzWaptutONiUseq7uB3VEAMAkGBSsOAwIdBQADgYEAToDMgeD82pqzIwVou1QKl0HAvpzPyLpdnVeR3hRqtEEA0+BscRiD1f6Yj//iYIjqRej5mYuKBrM6HB+AvhJYPamArtOobx9ux+hD2/sFcL9I7GqvSFB5q8tpq+VfMvGOVdwScOFBRLCzih05XvoAxT+T9vnlLqlgDI3UjatSeVk=" />
                    </identity>
                </endpoint>
            </client>
          <behaviors>
            <endpointBehaviors>
              <behavior name="clientBehavior">
                <clientCredentials>
                  <serviceCertificate>
                    <authentication certificateValidationMode="None" />
                  </serviceCertificate>
                </clientCredentials>
              </behavior>
            </endpointBehaviors>
          </behaviors>-->
            <bindings>
                <wsDualHttpBinding>
                    <binding name="WSDualHttpBinding_IService1">
                        <security>
                            <message clientCredentialType="UserName" />
                        </security>
                    </binding>
                </wsDualHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://192.168.10.2:8088/Service1.svc" binding="wsDualHttpBinding" behaviorConfiguration="myClientBehavior"
                    bindingConfiguration="WSDualHttpBinding_IService1" contract="ServiceReference1.IService1"
                    name="WSDualHttpBinding_IService1">
                    <identity>
                        <certificate encodedValue="AwAAAAEAAAAUAAAAfjtOt5msSsvixuf5OHDp++mEBjcgAAAAAQAAAP0BAAAwggH5MIIBYqADAgECAhALSZ5IIy2+vEZV0cG4RFaaMA0GCSqGSIb3DQEBBAUAMBUxEzARBgNVBAMTCldDRlNlcnZpY2UwHhcNMTQxMTE3MDMxMzA0WhcNMzkxMjMxMjM1OTU5WjAVMRMwEQYDVQQDEwpXQ0ZTZXJ2aWNlMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDVZBeYQP+9N955S97iDk9iVhB/UaJYLV3GIhIj/ZKtYVvekUv9HG+3+kPFn+REx4wxJdcaFQ4mp9kYL8ICqr9fLALtfIP4fmPMWXrHZgAQXxbeQlOAs0A9VnBJm/zq7AuMsOdNdesI/i9XoeocoItx+I7gwc8XOOFJgLVwqtSM9QIDAQABo0owSDBGBgNVHQEEPzA9gBClYvC+SrLI18uNCxtNEYaPoRcwFTETMBEGA1UEAxMKV0NGU2VydmljZYIQC0meSCMtvrxGVdHBuERWmjANBgkqhkiG9w0BAQQFAAOBgQCFylwZ7DlPqOFEKGb4iBpiSJd00MhhBYS6Rj9heY1nNPtRyKSo9CaSXfwA5MhD2jNY1z7eFW3t+U6rKvZIxn13GRPuJ1J+YcaSh2tYpdogGuaP4rXbWsyC8Bs/z41C/9yvN7gri4ORXD6L6q02YpESEak5aKM5Em1QC+7EPFitmA==" />
                    </identity>
                </endpoint>
            </client>
          <behaviors>
            <endpointBehaviors>
              <behavior name="myClientBehavior">
                <clientCredentials>
                  <serviceCertificate >
                    <authentication certificateValidationMode="None" />
                  </serviceCertificate>
                </clientCredentials>
              </behavior>
            </endpointBehaviors>
          </behaviors>
        </system.serviceModel>
    </configuration>

    客户端与服务端都在本机是可以的,如果将服务端部署在局域网远程机,客户端调用能触发验证代码,然后就一直等待抛出超时


    2014年11月17日 9:17

答案