【问题标题】:WCF EndpointNotFoundException takes longer than TimeoutExceptionWCF EndpointNotFoundException 比 TimeoutException 花费更长的时间
【发布时间】:2014-06-19 14:54:25
【问题描述】:

我设置了一组相互通信的服务;使用以下绑定,我会假设如果我“A”向“B”(活着)和“C”(不活着)发送一条消息,如果处理时间不超过定义的 sendTimeout,B 将返回,否则它将是超时异常。在“C”失败且不可用的情况下,我会假设它也会在 sendTimeout 定义的时间内返回。对于“B”,这似乎是正确的,但对于“C”,会捕获 EndpointNotFoundException,但它需要的时间比为 sendTimeout 定义的 5 秒长得多。我的配置中是否缺少某些内容。服务和客户端使用相同的绑定

<bindings>
  <netTcpBinding>
    <binding name="SSS" maxBufferPoolSize="524288" maxBufferSize="134217728" maxReceivedMessageSize="134217728" receiveTimeout="infinite" sendTimeout="00:00:05" portSharingEnabled="true">
      <readerQuotas
         maxDepth="32"
         maxStringContentLength="65535"
         maxArrayLength="16384"
         maxBytesPerRead="4096"
         maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="None" protectionLevel="None"/>
        <message clientCredentialType="None"/>
      </security>
      <reliableSession ordered="true"/>
    </binding>
  </netTcpBinding>
</bindings>


<service behaviorConfiguration="DefaultBehavior" name="hostObj"> 
    <endpoint binding="netTcpBinding" bindingConfiguration="SSS" contract="Contract.IHost" />
  </service>


<endpoint name="serverAppHostEndpoint" binding="netTcpBinding" bindingConfiguration="SSS" contract="Contract.IHost" />


<behaviors>
  <serviceBehaviors>
    <behavior name="DefaultBehavior">
      <!-- To avoid disclosing metadata information, 
      set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="False" />
      <!-- To receive exception details in faults for debugging purposes, 
      set the value below to true.  Set to false before deployment 
      to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

【问题讨论】:

    标签: c# wcf timeoutexception endpointnotfoundexception


    【解决方案1】:

    我不能 100% 确定,但您可能会遇到这样一个事实,即当 WCF 客户端执行时,操作系统用于解析 IP 地址的时间不计入 SendTimeout 设置。您可以在此处查看更多详细信息:WCF Not Timing out correctly?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-22
      • 2012-02-18
      • 2019-08-24
      • 1970-01-01
      • 2021-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多