IIS7:AppDomain 没有在应该回收的时候回收?

发布于 2024-08-23 15:51:10 字数 1072 浏览 2 评论 0原文

根据我们网站上发生的一些奇怪的事情,我向您提出了一个奇怪的问题。我们的 ASP.Net 解决方案中有四个 .DLL(即 /bin 文件夹中的托管代码)。今天早上我们更新了所有四个,该网站经过测试并且运行良好。

这个下午我上传了其中一个 DLL 的新版本,它导致整个网站瘫痪,这让我们非常沮丧。我迅速将新站点换成旧站点,使站点恢复到上传 DLL 之前的状态,但站点仍然处于关闭状态。我们被迫重新启动整个服务器,但仍然没有喜悦:就我们而言,该网站已恢复到与我上传任何内容之前完全相同的状态,但它仍然无法工作。

因此,经过一番调查后,我们发现这是早上上传的其中一个 DLL 中的一个错误(即与我下午上传的 DLL 无关)。

我们似乎发现,由于某种奇怪的原因,当我们早上上传 DLL 时,AppDomain 没有正确回收。对站点所做的一些更改已生效,但至少有一个 DLL 仍被缓存,而不是被更新。

那天下午晚些时候,当我上传一个 DLL 时,它导致了 AppDomain 回收,其中包括了今天早上上传的有缺陷的 DLL。

还有其他人遇到过 AppDomain 在应该回收时没有回收的问题吗?或者可能有另一种解释?据我所知,每次对 bin/ 文件夹中的任何文件进行更改时,AppDomain 都应该被回收...如果是这样,它是如何意外缓存文件的旧版本并且无法正确回收的?

以下是 Scott Forsyth 谈论 AppDomain 回收的内容:http://weblogs.asp.net/owscott/archive/2006/02/21/ASP.NET-v2.0-< em>2D00-AppDomain-recycles_2C00_-more-common-than-before.aspx

got a weird question for you based on some weird happenings on our site. We have four .DLLs in our ASP.Net solution (ie. managed code in the /bin folder). This morning we updated all four of them, the site was tested and worked fine.

This afternoon I uploaded a new version of one of the DLLs, and it took the whole site down, much to our dismay. I quickly swapped out the new one for the old one, taking the site back into the state before I'd uploaded the DLL, but the site was still down. We were forced to restart the entire server, but still no joy: As far as we were concerned, the site had been returned to exactly the same state it had been in before I'd uploaded anything, and it still wasn't working.

So, after a bit of investigating we discovered that it was a bug in one of the DLLs that had been uploaded that morning (i.e not related to the DLL I'd uploaded in the afternoon).

What we seem to have discovered is that, for some odd reason, the AppDomain didn't recycle properly when we uploaded our DLLs in the morning. Some of the changes made to the site went live, but at least one of the DLLs remained cached, instead of being updated.

When I uploaded a DLL later that afternoon, it caused an AppDomain recycle which then included the bugged DLL that was uploaded this morning.

Has anyone else had problem with the AppDomain not recycling when it should? Or possibly have another explanation for what it could be? AFAIK the AppDomain should be recycled every time there's a change made to any file in the bin/ folder... If so, how did it accidentally cache an older version of a file and not recycle properly?

Here's Scott Forsyth talking about AppDomain recycling: http://weblogs.asp.net/owscott/archive/2006/02/21/ASP.NET-v2.0-2D00-AppDomain-recycles_2C00_-more-common-than-before.aspx

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜柠檬 2024-08-30 15:51:10

有时,如果站点处于负载状态,则不会回收,因为 IIS 认为继续运行比在站点重新启动所需的时间内让所有人都停机更好。

在大多数地方,我的最佳做法是在更新站点文件后始终发出 IISRESET。这确保了部署后所有内容都得到回收。

Sometimes the site won't recycle if it is under load as IIS thinks it is better to keep running than take everyone down for the amount of time the site requires to restart.

At most places I've been the best practice is to always issue an IISRESET after updating the site files. This ensures everything gets recycled after a deployment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文