In many cases, we will have the code, which will run for a long time to perform some operations, for example, to read the data from multiple places. Thus, in those cases, we may face that our code will throw "Thread was being Aborted" error message.
In order to fix this issue, we have to increase the execution timeout value in the Web.config file.
Open the Web.config file for the particular Web Application.
- <httpRuntime maxRequestLength=”51200″ />
- Replace it with the tag, given below: ( Add the executionTimeout parameter
- <httpRuntime executionTimeout=”6000″ maxRequestLength=”51200″ />
- Save your changes, and close the web.config file.
Do iisreset to make the latest Web.config to reflect. Now, the long operations won’t throw an error. The thread was being aborted.