WCF 超时错误 - 即使在增加值之后 [英] WCF Timeout Error - Even after increasing the values

查看:29
本文介绍了WCF 超时错误 - 即使在增加值之后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的客户一直抱怨他们收到超时错误,但我没有看到我这边生成的跟踪文件.谁能告诉我如何解决这个问题?

My client keep complaining that they are receiving Timeout error but I don't see a trace file generated on my side. Can anybody tell me how to fix this?

我已经将 receiveTimeout 增加到 15 分钟 (00:15:00).我在 WCF 服务端和客户端都这样做了.我的服务不是一个长时间运行的进程,客户端应该在 0 - 2 分钟内收到响应.

I already increase the receiveTimeout to 15 minutes (00:15:00). I did this both on WCF service side and on the client side. My service is not a long running process, the client should receive the response in 0 - 2 minutes max.

不仅receiveTimeout 并且我将所有超时设置为00:15:00,我还将serviceThrottling (maxConcurrentCalls,maxConcurrentInstances,maxConcurrentSessions) 设置为200.

Not only receiveTimeout and I set the all timeouts to 00:15:00, also I set the serviceThrottling (maxConcurrentCalls,maxConcurrentInstances,maxConcurrentSessions) to 200.

注意:当出现超时错误时,我在跟踪中看不到任何与此相关的内容.

Note: When ever there is an Timeout error, I don't see anything related to that in Tracing.

这是我的配置文件,

WCF 服务配置:

<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime executionTimeout="150" maxRequestLength="8192" />
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="MYWS" name="MYDEMO.MYDEMOCLS">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="SecureBinding" name="wsDemo" contract="MYINTERFACES.ICustomer">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" name="wsMex" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://192.168.0.1/Customer/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MYWS">
<serviceThrottling maxConcurrentCalls="200" maxConcurrentInstances="200" maxConcurrentSessions="200" />
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="SecureBinding" maxBufferPoolSize="2147483647" closeTimeout="00:15:00" openTimeout="00:15:00" receiveTimeout="00:15:00" sendTimeout="00:15:00" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Message">
<transport clientCredentialType="Windows" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
</system.serviceModel>

客户端配置:

<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime executionTimeout="150" />
</system.web>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsDemo" closeTimeout="00:15:00" openTimeout="00:15:00" receiveTimeout="00:15:00" sendTimeout="00:15:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:15:00" enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.0.1/DEMOSVCS/Customer.svc" binding="wsHttpBinding" bindingConfiguration="wsDemo" contract="PROJ.IFACE" name="wsDemo">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>

这是一个客户端代码

DemoClient client = new DemoClient("wsDemo"); 
DemoResponse DemoResponse = new DemoResponse(); 
try 
{ 
    DemoResponse = client.CreateProduct(product); 
    client.Close(); 
    return DemoResponse; 
} 
catch (Exception ex) 
{ 
    try 
    { 
        if (client.State == CommunicationState.Faulted) 
            client.Abort(); 
        else 
            client.Close(); 
        throw ex; 
    } 
    catch 
    { 
        client.Abort(); 
        throw ex; 
    } 
} 

谢谢

推荐答案

超时错误很难诊断.在通过网络传输大型数据集时,我们遇到了与 WAN 延迟完全相关的问题.

Timeout errors are hard to diagnose. We've had issues that were completely related to WAN latency while passing large datasets across the wire.

但是,如果您发现一旦发生超时,就无法再调用 Web 服务,我会查看此 WCF 3.5 &4.0 修补程序

However, if you find that once the timeout occurs, no further calls to the web service can be made, I would look into this WCF 3.5 & 4.0 Hotfix

这篇关于WCF 超时错误 - 即使在增加值之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆