Prevent reuse by IIS workflows for individual ASP.Net AppDomains applications

When IIS restarts the ASP.Net (2.0) web application, it can:

  • Backup AppDomain . Unload the AppDomain and load the new AppDomain into the same process (for example, when called HttpRuntime.UnloadAppDomain(), when web.config changes).
  • Restart the process : unload the AppDomain and load the new one into the new process (for example, when calling the Recycle command in AppPool via inetmgr or when the memory limit is reached).

Due to some internal reasons (a problem with outdated code that we depend on), we cannot resolve the first option. We simply cannot download the application twice in the same process.

Can IIS somehow say to never allow reuse of a workflow?

I tried to prevent it myself by monitoring whether the application was already running in the process after using Mutex, and if so, throwing an exception during Application_Start()); I also tried to complete the process by calling Environment.Exit()on time Application_End(). The problem with both methods is that it causes any requests that arrive during Application_End or Application_Start to fail (unlike manual processing of a process that does not execute absolutely any requests because it is immediately redirected to a new process).

+3
source share
2

IIS, . , . , Environment.Exit(0) Application_End, reset.

0

, "Recycle the AppDomain" ASP.NET, IIS ( 100% IIS7). , , , . , :

  • , ( ) - . , , , , .

  • # 1 , , , , - ​​ WCF . ASP.NET .

0

Source: https://habr.com/ru/post/1765807/


All Articles