我有一组在 Azure网站
中运行的asp.net 4.0网站响应时间非常慢,流量正常,但我的日志显示许多 AppDomain关闭(一分钟内超过3次)。我的网站在de Application_Start期间在缓存中加载数据,以快速响应所有子请求,但是如果每次重新启动Appdomains都无法给出可接受的响应时间。
ShutdownReason 值很多:
这没有任何意义,因为我没有更改这些文件夹中的任何文件。
我在免费模式下测试了其中一个网站,运行速度非常快,没有任何意外的AppDomain重启。
感谢。
更新
我已将此代码包含在Application_Start中,未检测到文件更改且AppDomain再次重新启动,并再次...
var monitorPath = HostingEnvironment.MapPath("~/");
Application.Add("watcher", new FileSystemWatcher(monitorPath));
fsw = (FileSystemWatcher) Application["watcher"];
fsw.EnableRaisingEvents = true;
fsw.IncludeSubdirectories = true;
fsw.Changed += fsw_Changed;
fsw.Created += fsw_Created;
fsw.Deleted += fsw_Deleted;
fsw.Renamed += fsw_Renamed;
2013年7月15日更新:
使用ScottGu文章http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx
中的代码我记录了这个:
_shutDownMessage=Directory rename change notification for 'C:\DWASFiles\Sites\my-sitename\VirtualDirectory0\site\wwwroot'.
File Change Notification Error in wwwroot
HostingEnvironment initiated shutdown
Change Notification for critical directories.
File Change Notification Error in App_GlobalResources
Change Notification for critical directories.
File Change Notification Error in bin
Change Notification for critical directories.
File Change Notification Error in App_Browsers
Change Notification for critical directories.
File Change Notification Error in App_Code
Change Notification for critical directories.
File Change Notification Error in App_WebReferences
CONFIG change
CONFIG change
CONFIG change
CONFIG change
CONFIG change
CONFIG change
CONFIG change
CONFIG change
CONFIG change
CONFIG change
File Change Notification Error in C:\DWASFiles\Sites\my-sitename\VirtualDirectory0\site\wwwroot
CONFIG change
File Change Notification Error in
HostingEnvironment caused shutdown
File Change Notification Error in
Change Notification for critical directories.
File Change Notification Error in App_LocalResources
Change Notification for critical directories.
File Change Notification Error in App_LocalResources
CONFIG change
_shutDownStack= at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()
at System.Web.Hosting.HostingEnvironment.InitiateShutdownWithoutDemand()
at System.Web.HttpRuntime.ShutdownAppDomain(String stackTrace)
at System.Web.HttpRuntime.OnCriticalDirectoryChange(Object sender, FileChangeEvent e)
at System.Web.FileChangesMonitor.OnSubdirChange(Object sender, FileChangeEvent e)
at System.Web.DirectoryMonitor.FireNotifications()
at System.Web.Util.WorkItem.CallCallbackWithAssert(WorkItemCallback callback)
at System.Web.Util.WorkItem.OnQueueUserWorkItemCompletion(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
2013年7月19日更新:
指标数据输入非常高且与请求指标无关,但是当我配置设置fcnMode =“已禁用”时,数据输入立即降至正常值符合流量。
答案 0 :(得分:3)
在asp.net 4.5中使用新设置fcnMode(似乎在4.0中工作),AppDomain停止重启
<httpRuntime fcnMode="Disabled" />
但是,现在的问题是为什么azure网站中的FileChangesMonitor(至少在我订阅的网站中)给出了这个_shutDownMessage:
File Change Notification Error in wwwroot
HostingEnvironment initiated shutdown
Change Notification for critical directories.
File Change Notification Error in App_GlobalResources
Change Notification for critical directories.
File Change Notification Error in bin
Change Notification for critical directories.
File Change Notification Error in App_Browsers
...
<强>更新强>
原因是SMB中的一个错误只影响了北欧的位置。