简体   繁体   中英

C#: Timeout does not match elapsed time

I have an application that connects to a service (webserviceSoap1), and that service has the next timeout configuration:

<binding name="webserviceSoap1" 
         openTimeout="00:10:00" 
         closeTimeout="00:10:00" 
         sendTimeout="00:10:00"
         receiveTimeout="00:10:00">

From what I understand, I'm stating here that all timeouts have to wait at least 10 minutes to end communication and get a System.TimeoutException . However, here is the issue I'm not understanding . After around 2-3 minutes, i get a TimeoutException saying that the program waited for a response almost ten minutes (which is not possible), and in the same place, it says the elapsed time was around two minutes

超时异常表明它等待了将近10分钟,但经过的时间约为2分钟

Why the gap of time? Am I configuring the binding values correctly?

If I change the values of the timeouts to "10:00:00" it will complete the process correctly. However, still using "01:00:00", which I understand is an hour, the process breaks after 4 minutes saying that it waited "00:59:59.16472" before sending the TimeoutException.

The problem was located within the Load Balancer that was managing the connection of the client to the server. Both the client and the service were configured to wait 10 minutes of timeout. However, the Load Balancer had only one minute, and that's why the timeout was arising sooner than expected.

I ask the administrators of the Load Balancer to change it to 10 minutes and everything is working as expected.

However, the way the timeout is reported to the client is very misleading, since it states that the set timeout has already reached to the limit, when this is not true.

Also, the way the Load Balancer manages the interruption of the service can be misleading, since in my case, the Load Balancer (F5) would wait until the service returns a response, and then, it would interrupt the response, arising its own timeout error. As a result, the client only receives the notice of the reached timeout. Also, the client will not get this error in one minute (set by the load balancer), nor in 10 minutes (set by the service), but at the time the service returns the response.

I hope this helps to anyone getting a similar behavior.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM