c# - WCF 调用者未通过 WsDualHttpBinding 中的服务进行身份验证

标签 c# wcf wsdualhttpbinding

我有一个使用 wsDualHttpBinding 的 wcf 服务,当我尝试使用同一域中的不同电脑连接到它时,我收到该错误。

这是我的客户端配置:

       <binding name="WSDualHttpBinding_IRouter" closeTimeout="00:00:05"
        openTimeout="00:00:05" receiveTimeout="00:10:00" sendTimeout="00:00:05"
        bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
        maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" />
      <security mode="Message">
        <message clientCredentialType="Windows" negotiateServiceCredential="true"
            algorithmSuite="Default" />
      </security>
    </binding>

如果我将安全性更改为:

        <binding name="WSDualHttpBinding_IRouter" closeTimeout="00:00:05"
        openTimeout="00:00:05" receiveTimeout="00:10:00" sendTimeout="00:00:05"
        bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
        maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" />
      <security mode="None">
        <message negotiateServiceCredential="false" clientCredentialType="None" />
      </security>

    </binding>

我遇到超时异常。

有人有办法解决这个问题吗?请注意,我不使用 wsDualHttpBinding(基本或 wsHttpBinding)。

最佳答案

我必须将其作为客户端配置:

     <binding name="WSDualHttpBinding_IReceiverController" closeTimeout="00:00:05"
        openTimeout="00:00:05" receiveTimeout="00:10:00" sendTimeout="00:00:05"
        bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
        maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" />
      <security mode="None">
        <message clientCredentialType="None" negotiateServiceCredential="false" />
      </security>
    </binding>

注意将安全模式更改为None并将negotiateServiceCredential更改为false

同样在服务器中,绑定(bind)应该是:

 <binding name="WSDualHttpBinding_IReceiverController" closeTimeout="00:00:05"
        openTimeout="00:00:05" receiveTimeout="00:10:00" sendTimeout="00:00:05"
        bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
        maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" />
      <security mode="None" />
    </binding>

注意安全模式

关于c# - WCF 调用者未通过 WsDualHttpBinding 中的服务进行身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7866902/

相关文章:

c# - 如何在自托管 Web API 上发送文件并在服务器上处理它?

wcf - 性能调优 WCF 服务

java - WCF与java客户端双向通信

c# - WPF:从代码动画化 TranslateTransform

c# - 使用 System.Web.Optimization 时如何将类型 ="text/javascript"添加到脚本标记

C# 柏林噪声

c# - 是否可以在有人连接之前在 WCF 服务中执行启动代码?

wcf - OData 是否违反关注点分离?

wcf - WsDualHttpBinding 不回调客户端,及时处理问题