ASP.NET Web应用程序不卸载部署后的AppDomain [英] ASP.NET Web application doesn't unload AppDomains after deploy

查看:299
本文介绍了ASP.NET Web应用程序不卸载部署后的AppDomain的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们部署我们的Web应用程序,我们复制所有code到一个新的目录,然后指向IIS到新目录中。当我们做到这一点的AppDomain数的增加,但从来没有减少。此外,我们的Application_End事件似乎永远不会触发。

When we deploy our web application we copy all the code to a new directory and then point iis to that new directory. When we do this the number of appdomains increases but never decreases. Also, our Application_End event never seems to fire.

有关一些未知的时间,而应用程序域的两个集都尚通过性能监视器报告,系统执行很差GC中尖峰为100%,而%的时间。最后,我回收应用程序池来获得应用程序流畅运行再次

For some unknown time, while both sets of AppDomains are still reported by perfmon, the system performs very poorly while % time in GC spikes to 100%. Eventually I recycle the app pool to get the app running smoothly again.

<击>附加一块信息:列出的AppDomain我开发的机器上显示2,但4现场服务器上运行......我们只是在池中运行一个应用程序所以这意味着我们使用一些库创建应用程序域。

我应该怎么做,以尝试调试发生了什么?什么会prevent一个应用程序域卸载从

What should I do to try to debug what's happening? What would prevent an app domain from unloading?

更新2014年9月3日

在得到它看起来像问题的一些更详细的日志信息并非酒店周围的老应用程序域,它的重新启动过程中创造了新的应用程序域。相反入手一部新实例的应用程序,它启动两个。有时候,我们从旧的实例application_end得到,有时候我们不知道。

After getting some more detail log information it looks like the problem is not old app domains staying around, it's new appdomains created during restart. Instead of the application starting one new instance, it starts two. Sometimes we get application_end from the old instance, sometimes we don't.

更新2014年9月4日

这两个事情正在发生。使用进程管理器,我可以看到,旧的应用程序域仍然存在,一个新的开始的机器之一。在其他计算机上,只有2应用程序域,但有他们的顺序ID的差距。于是两个实例开始(我们也得到应用开始的日志消息),其中一人离开了人世几乎是瞬间,留下2应用程序域。

Both things are happening. Using process explorer I can see on one of the machines that the old app domain is still there and a new one has started. On the other machine there were only 2 app domains but there was a gap in their sequential ids. So two instances started (we also get a log message from app start), one of them died off almost instantly, leaving 2 app domains.

推荐答案

虽然我不知道这是唯一的原因,应用程序不卸载应用程序域,它肯定是一个原因。实际的答案是有趣的要少得多比我以前的步骤看着办吧。

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. 我写了一个小Ruby脚本,只是以在对付我们的应用程序10个线程的请求100S(设置启动JMeter将采取比这更多的时间)。

  2. 运行脚本和应用程序的配置文件很多次,而它跑所做的更改。这花了几分钟的时间。

  3. 我使用Process Explorer的确认,有确实仍然加载到进程4应用程序域。

  4. 我跑procdump和创建转储文件。

  5. 加载procdump文件到Visual Studio,并点击调试只用管理(虽然我不知道如果bug在管理code与否)

  6. 调试器停在一条线code哪里调用Application_End线程在等待队列来完成处理。通过查看变量的值,我可以告诉大家,队列不再打算处理项目,但我们要等到队列为空。

  7. 改变了code和从头再来的过程,这次全部由我改变web配置启动应用程序域被卸载了。

这篇关于ASP.NET Web应用程序不卸载部署后的AppDomain的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆