简体   繁体   中英

How to detect if the Service(Web API) has lost connection to the HttpClient?

Is there a good way to detect if the service has lost connection to the HTTP client of the current request being processed? My service is built on Web API in C#.

I have observed that the server keeps on waiting for 120 seconds before it raises following exception. Where can I configure this setting to wait less? "System.Net.HttpListenerException: The I/O operation has been aborted because of either a thread exit or an application request"

thx

Use the Timeout Property of the object you're using.

Check this for HttpWebRequest .

Check this for HttpClient .

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