【问题标题】:WCF + net.tcp Communication Timeout problemWCF + net.tcp 通信超时问题
【发布时间】:2011-04-07 07:09:41
【问题描述】:

我的项目中有一些关键问题。在与 (wcf + netTCP) 的交易时间内 我得到的例外是。

The communication object, 
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel, 
cannot be used for communication because it is in the Faulted state.

在 WCF 服务 app.config 中添加带有超时规范的绑定标记。但我的交易已在 10 分钟内结束。有什么问题..

 <bindings>
      <basicHttpBinding>
        <binding name="ServiceSoap" closeTimeout="0:01:00" openTimeout="0:01:00" receiveTimeout="10:00:00" sendTimeout="10:00:00" allowCookies="false"
          bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
      <netTcpBinding>
        <binding name="b1" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="infinite" sendTimeout="10:00:00"

transferMode="Buffered"

maxBufferPoolSize="524288"

maxBufferSize="65536"

maxConnections="10"

maxReceivedMessageSize="65536">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>

谁能帮帮我!!!..

【问题讨论】:

    标签: wcf nettcpbinding net-tcp


    【解决方案1】:

    我不确定您为什么认为这是超时问题?错误消息并不表明发生了超时。服务器会抛出异常吗?

    我强烈建议设置WCF tracing。它有点涉及但真的很值得做,因为我已经用它解决了许多晦涩的 WCF 问题。

    【讨论】:

    • 没有看到更多代码,我不知道如何解决这个问题。可能有序列化问题?您确实需要设置 WCF 跟踪以进一步调试问题。
    【解决方案2】:

    尝试将此添加到您的 netTcpBinding:

    <reliableSession inactivityTimeout="infinite" enabled="true" />
    

    如果这不起作用,请启用 WCF 跟踪以找出导致它的原因。

    【讨论】:

      【解决方案3】:

      这不是一个完整的答案,但如果您在同一台机器上使用客户端 + 服务器,则可以使用命名管道绑定而不是 netTcp

      配置的绑定部分可能如下所示。

      <netNamedPipeBinding>
        <binding name="infiniteOpenBindingConfig" receiveTimeout="infinite" closeTimeout="infinite">
        </binding>
      </netNamedPipeBinding>
      

      要使绑定无限期地保持活动状态,必须在服务器和客户端上都设置上述配置。

      【讨论】:

      • 我在不同的地方使用服务器机器。可能是我尝试制作 http 而不是 netTcp
      • 任何人都有解决方案
      猜你喜欢
      • 2012-05-26
      • 2011-05-20
      • 1970-01-01
      • 1970-01-01
      • 2011-06-19
      • 2011-12-28
      • 1970-01-01
      • 2012-03-05
      相关资源
      最近更新 更多