【发布时间】:2014-12-31 20:15:51
【问题描述】:
我有一组在 Azure 网站 中运行的 asp.net 4.0 网站
- 计算模式:标准
- 地点:北欧
- 容量自动缩放:关闭
- 实例大小:大
- 实例计数:1
响应时间很慢,流量正常,但是我的日志显示很多AppDomain 关闭(一分钟超过3 次)。我的网站在 de Application_Start 期间将数据加载到缓存中,以快速响应所有后续请求,但如果 Appdomains 每次都重新启动,则无法提供可接受的响应时间。
ShutdownReason 值很多:
- 配置更改
- 托管环境
- CodeDirChangeOrDirectoryRename
- BinDirChangeOrDirectoryRename
- BrowsersDirChangeOrDirectoryRename
这没有任何意义,因为我没有更改这些文件夹中的任何文件。
我已经在免费模式下测试了其中一个网站,运行速度非常快,并且没有任何意外的 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 日更新:
Data-In 指标非常高,与请求指标无关,但是当我配置设置 fcnMode=”Disabled” 时,data-In 立即下降到正常值符合交通。
【问题讨论】:
-
看起来您执行写入您的应用程序的根文件夹的子文件夹。我想你最好的办法是获取根文件夹中的文件列表以及修改时间,并仔细查看它们,以便找到触发重启的原因。我曾经自己遇到过这个问题,并通过消除写入来解决它。
-
您是否使用 FTP 或 Kudu-VFS 检查了 /LogFiles 文件夹?这是您会看到您的站点抛出任何异常的地方。返回导致站点工作进程终止的内容后,您可能会抛出未处理的异常。使用发布配置文件中的详细信息通过 FTP 连接或登录 https://
.scm.azurewbsites.net/vfs 以使用 Kudu VFS。您可以使用 Kudu ZIP 下载整个日志目录,如下所示:https:// .scm.azurewebsites.net/zip/LogFiles -
网站没有向磁盘写入任何字节,eventlog.xml 只有一小部分异常。 :-(
-
日志中没有任何未处理的异常。
标签: azure appdomain azure-web-app-service