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.

  1. <httpRuntime maxRequestLength=”51200″ />
  1. <httpRuntime executionTimeout=”6000″ maxRequestLength=”51200″ />

Do iisreset to make the latest Web.config to reflect. Now, the long operations won’t throw an error. The thread was being aborted.