WCF Distributed development Common error (M): TimeoutException was unhandled

Source: Internet
Author: User

This exception often occurs when a large number of clients send requests to WCF services during WCF application development. WCF Service response timeout. The operation was not opened within the specified time 00:01:00, and the time allotted for this operation may be only part of the timeout period.

The error message is as follows:

The open operation did not complete within the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout.

"1" Error screenshot:

"2" Reason analysis:

This timeout exception arises directly because a large number of client requests are sent to the service. I use 100 clients here and instantiate 100 agents. Then request. Simulate a large number of concurrent requests from the client. Service basic delay 100MS. Analog processing. This is about 10 requests, and the service processing is blocked. And then wait, and finally the timeout exception occurs.

"3" Solution:

When it comes to a large number of requests, consider using WCF's Servicethrottlingbehavior property.

TD style= "BORDER:0;PADDING:0;" > description
name
maxconcurrentcalls
maxconcurrentinstances
maxconcurrentsessions

Here we set the service limit flow behavior on it. as follows:

Servicebehaviors>

<behavior name= "Wcfservice.wcfservicebehavior" >

<servicetimeouts transactiontimeout= "00:01:00"/>

<servicemetadata httpgetenabled= "true"/>

<servicedebug includeexceptiondetailinfaults= "false"/>

<servicethrottling maxconcurrentcalls= "1000" maxconcurrentinstances= "1000" maxconcurrentsessions= "1000"/>-- >

</behavior>

</serviceBehaviors>

Here 1000 can be modified according to your actual WCF service demand. Service activation type and instance invocation method. And then make adjustments. After the modification, restart the service, basically normal.

Source: http://www.cnblogs.com/frank_xl/archive/2009/07/22/1528911.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.