【问题标题】:WCF Service throwing a timeout error when using WcfTestClient使用 WcfTestClient 时 WCF 服务引发超时错误
【发布时间】:2012-07-13 19:02:50
【问题描述】:

如果我发送的参数会导致大量数据被拉取,我会收到以下错误:

请求通道在 00:01:00 后等待回复时超时。增加传递给 Request 调用的超时值或增加 Binding 上的 SendTimeout 值。分配给此操作的时间可能是较长超时的一部分。

我增加了所有超时时间。我必须在客户端做些什么吗?我想知道这是否是因为我使用的是 wcftestclient?需要调整 operationTimeout 吗?

我的 webconfig 有以下内容:

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="Basic" sendTimeout="12:00:00" receiveTimeout="12:00:00" openTimeout="00:10:00" closeTimeout="00:10:00"
                 maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
          <readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="8192"/>          
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="CaseStudyBehavior" name="EDTFS.ADMS.CaseStudyService">        
        <endpoint address="" 
                  binding="basicHttpBinding"
                  bindingConfiguration="Basic"                    
                  name="Basic"                    
                  contract="EDTFS.ADMS.ICaseStudyService" />
        <endpoint address="mex" 
                  binding="mexHttpBinding"
                  name="Metadata"
                  contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="CaseStudyBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceTimeouts transactionTimeout="24:00:00"/>
          <serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

【问题讨论】:

    标签: wcf web-config wcftestclient


    【解决方案1】:

    在 WCF 测试客户端中,您会在服务下方找到一个名为 Config File 的节点。右键单击它并选择Edit with SvcConfigEditor 以增加客户端的超时时间。

    【讨论】:

    • 这行得通,但我每次在本地运行我的服务时都必须这样做。有没有办法让它永久存在?
    • 在 WCF 测试客户端菜单中选择 Tools -> Options... 并取消选中 Always Regenerate Config When Launching Services.
    猜你喜欢
    • 1970-01-01
    • 2010-09-16
    • 1970-01-01
    • 1970-01-01
    • 2011-09-01
    • 2012-03-23
    • 2010-09-18
    • 2013-01-15
    相关资源
    最近更新 更多