WCF service timeout
Solution 1
There is no built in (out of the box) way to do this. All of the timeouts that you can set are related to transport settings. In short words, you have to do that yourself.
Please also see this answer about limiting WCF execution time.
Solution 2
You can set this up in your service bindings, the link below shows the values to set on the service side as well as client side.
Solution 3
We can set server side time out in "Binding" with:
Binding.ReceiveTimeout
This is the timeout that specifies how long the service can wait from the beginning of receiving a request until the message is processed. It’s server-side setting. When you send a large message to the service and the service needs long time to process, you would need to increase this setting.
http://msdn.microsoft.com/en-us/library/ms731361.aspx
Using these two timeouts should solve most timeout problems. However, when a WCF service is hosted in IIS/ASP.NET, another setting would also control the lifetime of the request:
HttpRuntimeSection.ExecutionTimeout
<configuration>
<system.web>
<httpRuntime executionTimeout="600"/>
</system.web>
</configuration>
zimdanen
Updated on September 06, 2022Comments
-
zimdanen over 1 year
Is there a way to set a tiemout on the service side so that the request stops processing if it exceeds the timeout? I know I can time the request out on the client side, but that doesn't stop the processing of the request on the server.
I've tried adding the following binding:
<basicHttpBinding> <binding name="timeout" receiveTimeout="00:01:00" closeTimeout="00:01:00" openTimeout="00:01:00" sendTimeout="00:01:00" /> </basicHttpBinding>
I've also tried adding the following in the system.web node (separately and together with the above):
<httpRuntime executionTimeout="60" /> <!-- timeout after 60 seconds -->
-
zimdanen about 12 yearsThat's a good article, but setting the timeouts on the binding doesn't seem to work. Neither does setting the httpRuntime executionTimeout.
-
zimdanen about 12 yearsSee my most recent edit - that doesn't seem to limit the time from start to end of the full service call, which is what I'm trying to do.
-
zimdanen about 12 yearsThanks. May have to wait for a later project, then, since I won't have time to get a custom solution into the current project.
-
D.R. about 8 yearsAFAIK that is not true. For more information on
ReceiveTimeout
see rauch.io/2015/06/25/all-wcf-timeouts-explained