Recently, I was working on a project. Because files are modified, added, and deleted in the project, all these operations were completed when IIS was running, and the progress was also tracked, it involves threads and so on. Therefore, we apply static variables to complete this trail. However, when the project is running, static variables often fail, and this result is caused by the application of IIS.ProgramRestart the application pool to reclaim static variables. I didn't notice this problem before, so I figured it out for a long time.
There may be many ways to restart the application, but this time I met the following several methods, maybe this is what I wrote down.
1. As long as we update the web. config file, replacing the file will cause the application to restart;
2. The update of the global Global. asax file will also cause the restart. This file is an application, a bit like a pipeline model;
3. An update to the bin directory also causes file restart;
4 ....
The restart of the application will invalidate all our variables, caches, and so on, and sometimes bring us the desired results. This application also encountered thread operations. currentthread. when abort () is used to terminate a thread, an error is thrown, which corresponds to response. redirect (string) has the same effect, so try {} catch {} cannot be used.