不更改任何子目录或文件在ASP.NET应用程序回收应用程序池 [英] Does changing any sub-directory or file in an ASP.NET application recycles the app pool

查看:134
本文介绍了不更改任何子目录或文件在ASP.NET应用程序回收应用程序池的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以为我知道ASP.NET很好,直到几个小时前。我知道一个IIS可以回收应用程序域由于各种原因,包括更改的web.config /斌/ App_GlobalResources文件等文件/目录,或以其他方式安排或特定事件(如达到一个特定的内存门限)。

I thought I knew ASP.NET well, until a couple of hours ago. I am aware an IIS can recycle an app domain due to a variety of reasons including changes to web.config/bin/App_GlobalResources etc. file/directories, or otherwise on schedule or on specific events (like reaching a specific memory threshhold).

我非常确信我的code没有击中任何这些条件。基本上一个普通的http请求将引发后台线程(ThreadPool.QueueUserWorkItem)的woould导致PDF文件的写我的ASP.NET应用程序的一个子目录里面的小任务。

I was very sure my code was NOT hitting any of these conditions. Basically a regular http request would trigger a small task in a background thread (ThreadPool.QueueUserWorkItem) that woould lead to writing of a pdf file inside a sub-directory of my ASP.NET app.

本次目录也没有什么理由将有资格它引起应用循环。它是这样的:

This sub-directory had nothing that would qualify it for causing a app recycle. It was something like:

我的网站\\公司名称\\梅勒\\ UploadFiles

My Site\CompanyName\Mailer\UploadFiles

请不要建议像配置或bin目录变化的原因,code是变着法子在ASP.NET中的文件夹。它写入non-ASP.NET目录中的PDF文件。

Please don't suggest reasons like configuration or bin directory change, the code is changing nothing in ASP.NET folders. Its writing to a pdf file inside a non-ASP.NET directory.

我用Application_End事件弄清楚回收(使用反射的原因如下建议:的 http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx ),并得到这个:

I used the Application_End event to figure out the reason of recycle (using reflection as suggested here: http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx) and got this:

_shutDownMessage=Directory rename change notification for 'd:\Projects\MyProject\trunk\dev'.
dev dir change or directory rename
HostingEnvironment initiated shutdown
HostingEnvironment caused shutdown
Directory rename change notification for 'd:\Projects\MyProject\trunk\dev'.
dev dir change or directory rename

我几乎难倒。我非常确信我已经写了code在其下应用程序的子direcories写入,而不会造成应用程序回收等项目。但这种情况下不

I am practically stumped. I am very sure I have written code on other projects which writes under the app's sub-direcories without causing app recycles. But not in this case.

我缺少的东西吗?它是预期IIS以回收应用程序域试图写入从ASP.NET应用程序本身的应用程序的任何子目录?

Am I missing something? Is it expected for IIS to recycle the app domain trying to write to any sub-directory of the app from the ASP.NET app itself?

推荐答案

有一个名为FileChangesMonitor啄它有一个文件夹列表观看,将触发一个应用程序的循环,如果这些变化。看来,只要一个资源(一个HTML页面,图像,或者在你的情况下,PDF)是通过HTTP请求提供服务,所在的文件夹变成一个ASP.NET文件夹,即加入到列出和监视更改。并不要紧的资源是否位于内部或应用程序的根之外。我遇到此问题与文件夹中删除,但我想同样的事情将与重命名发生。这是令人沮丧的,因为它使服务挥发性静态资源非常困难。

There is a thingy called FileChangesMonitor which has a list of folders to watch and will trigger an app recycle if any of these change. It seems that as soon as a resource (an html page, an image, or, in your case, a pdf) is served through an HTTP request, the folder where it is located becomes an ASP.NET folder, i.e. is added to the list and monitored for changes. And it does not matter whether the resources are located inside or outside the application root. I experienced this problem with folder deletes, but I guess the same thing would occur with renames. This is frustrating, because it makes serving volatile static resources very difficult.

这篇关于不更改任何子目录或文件在ASP.NET应用程序回收应用程序池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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