When developing a WCF application, if a large number of clients send requests to the WCF Service, this exception often occurs and times out. The WCF Service response times out. The operation is not enabled at the specified time 00:01:00. the time allocated to this operation may be only part of the timeout time. 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:
[2] Cause Analysis:
The cause of this timeout exception is that a large number of client requests are sent to the service. The 100 clients I use here instantiate 100 proxies. Request. Simulate a large number of concurrent requests on the client. The service latency is 100 ms. Simulate processing. Here, when there are about 10 requests, service processing is blocked. Then wait, and a timeout exception occurs.
[3] solution:
When a large number of requests are involved, you can consider using the servicethrottlingbehavior attribute of WCF. Description
Maxconcurrentcils gets or sets a value that specifies the maximum number of messages processed in the entire servicehost.
Maxconcurrentinstances gets or sets a value that specifies the maximum number of instancecontext objects that can be executed at a time in the service.
Maxconcurrentsessions gets or sets the maximum number of sessions that a specified servicehost object can accept at a time.
Here we can set the throttling behavior of the service. The details are as follows:
Code
<Servicebehaviors>
<Behavior name = "wcfservice. wcfservicebehavior">
<Servicetimeouts transactiontimeout = "00:01:00"/>
<Servicemetadata httpgetenabled = "true"/>
<Servicedebug includeexceptiondetailinfaults = "false"/>
<Servicethrottling maxconcurrentcils = "1000" maxconcurrentinstances = "1000" maxconcurrentsessions = "1000"/> -->
</Behavior>
</Servicebehaviors
Here, 1000 can be modified based on your actual requirements for the WCF Service. Service Activation type and instance call method. Then adjust. After the modification, restart the service.
Reference: http://msdn.microsoft.com/en-us/library/system.servicemodel.description.servicethrottlingbehavior_properties.aspx