ApplicationShutdownReason.BuildManagerChange和ApplicationPool在IISEx preSS重启重启、BuildManagerChange、Appl

2023-09-03 17:41:55 作者:北梦木兮

我们有一个问题。我们使用IISEx preSS 8.0 Asp.net web窗体应用程序(.NET 4.0)。 Comupter是在Windows 7 64位系统上运行。

We have a problem. We are using IISExpress 8.0 for Asp.net WebForm application(.net 4.0). Comupter is running under Windows 7 x64.

有时候,没有任何理由ApplicationPool重新启动。我知道,这将在15 ASPX \ ASCX文件更改重新启动。但在这种情况下,重启后没有任何更改。 在ApplicationEnd我们发现这个重启的原因。它的 ApplicationShutdownReason.BuildManagerChange

Sometimes without any reason ApplicationPool restarts. I know that it will restart after 15 aspx\ascx file changes. But in that case it restarts without any changes. On ApplicationEnd we found a reason of this restart. It's ApplicationShutdownReason.BuildManagerChange.

在互联网搜索将不会给任何有用的信息。大多都recomends来使用,而不是IISEx preSS IIS。

Search in the Internet won't give anything usefull details. Mostly all recomends to use IIS instead of IISExpress.

你知道这可能是一个原因吧?

Do you know what could be a reason for it?

更新

挖掘更深的.NET 4中源$ C ​​$ C给这个关闭的两个原因。 其中一人被触发时,有人从临时Asp.net文件夹改变hash.web文件。例如 - C:\ WINDOWS \ Microsoft.NET \ Framework64 \ v4.0.30319 \临时ASP.NET文件\程序\ a83dcad1 \ be4aa699 \哈希\ hash.web

Digging deeper into .Net 4 source code give two reasons of this shutdown. One of them is triggered when someone changed hash.web file from Temporary Asp.net folder. For example - "c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\app\a83dcad1\be4aa699\hash\hash.web"

第二个原因是,当BuildManager建在HttpCache一些对象和缓存BuildResult。然后,如果它过期它会检查,这个BuildResult需要ShutdownAppDomainOnChange在缓存过期。如果它是需要它,然后它会触发BuildManagerChange关机。

Second reason is when BuildManager built some object and cached BuildResult in HttpCache. And then if it's expired it checks that this BuildResult require ShutdownAppDomainOnChange on cache expiration. And if it's require it, then it triggers BuildManagerChange shutdown.

UPDATE2

在我们的情况下重新启动是由hash.web变化引起的。似乎IISEx preSS更新它没有任何来源$ C ​​$ c修改,但为什么?

In our case restart was caused by hash.web change. Seems IISExpress updates it without any source code change, but why?

UPDATE3 微软有一个关于它的问题 - https://connect.microsoft.com/VisualStudio/feedback/details/783440/microsoft-visualstudio-web-host-exe-touches-hash-web-and-should-not-be-running 他们说,他们固定在Visual Studio 2012更新2。

UPDATE3 Microsoft has an issue about it - https://connect.microsoft.com/VisualStudio/feedback/details/783440/microsoft-visualstudio-web-host-exe-touches-hash-web-and-should-not-be-running They say that they fixed it in Visual Studio 2012 Update 2.

推荐答案

这是不是一个完整的答案,所以采取一切得益于它,你可能需要。

This is not a full answer, so take whatever benefit from it you may take.

这似乎是两件事情正在发生:在 hash.web 的变化可能是因为IIS用来存储构建应用程序的DLL的临时位置。当此文件的更改,IIS了解您构建的应用程序的新版本,需要重新启动;这也许可以解释的应用程序池的复位。

It seems like two things are happening: the hash.web change is probably because IIS uses the temporary location to store the application DLL that you build. When this file changes, IIS understands that you built a new version of the application, and need to restart it; that may explain the application pool reset.

有关缓存过期,好像IIS正试图卸载并重新加载的东西在不同的应用程序域。有没有办法(在.NET)卸载程序集而不卸载的应用程序域(我认为),一旦它被加载的,所以这是正常的方式来实现这一目标。

For the cache expiration, it seems like IIS is trying to unload and reload something in a different app domain. There's no way (in .NET) to unload an assembly without unloading an app domain (I think) once it's been loaded, so this is "the usual" way to achieve this.

也许吧。