ASP.NET Web application doesn't unload AppDomains after deploy

元气小坏坏 提交于 2019-12-03 15:25:34

One thing you could check, to help troubleshoot:

Process Explorer actually has a .NET Assemblies tab which lists all the AppDomains loaded by a process. NOTE: The tab only appears for processes that use the .NET Framework.

Although I am not sure this is the ONLY reason the app was not unloading appdomains, it certainly is one reason. The actual answer is much less interesting than the steps I used to figure it out.

  1. I wrote a little ruby script to just make 100s of requests in 10 threads against our app ( setting up jmeter would take more time than this).
  2. Run script and made changes to the app config file many times while it ran. This took a couple of minutes.
  3. I used process explorer to confirm that there were indeed 4 app domains still loaded into the process.
  4. I ran procdump and created a dump file.
  5. Loaded the procdump file into visual studio and clicked "Debug with Managed Only" (even though I had no idea if the bug was in managed code or not)
  6. Debugger stopped on a line of code where the thread that called Application_End was waiting for a queue to finish processing. By looking at the values of the variables I was able to tell that the queue was no longer going to process items but we were going to wait until the queue was empty.
  7. Changed the code and start process over again, this time all the app domains started by my changes to the web config were unloaded.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!