Azure网站AppDomain多次重新启动

Azure网站AppDomain多次重新启动,azure,appdomain,azure-web-app-service,Azure,Appdomain,Azure Web App Service,我有一组asp.net 4.0网站运行在Azure网站中 计算模式:标准 地点:北欧 容量自动缩放:关闭 实例大小:Large 实例数:1 响应时间非常慢,流量正常,但我的日志显示AppDomain多次关闭(一分钟内超过3次)。我的网站在反应用程序启动期间将数据加载到缓存中,以快速响应所有后续请求,但如果Appdomains每次都重新启动,则无法提供可接受的响应时间 关闭原因的值很多: 构型改变 寄宿环境 CodeDirChangeOrDirectoryRename bindirchang

我有一组asp.net 4.0网站运行在Azure网站中

  • 计算模式:标准
  • 地点:北欧
  • 容量自动缩放:关闭
  • 实例大小:Large
  • 实例数:1
响应时间非常慢,流量正常,但我的日志显示AppDomain多次关闭(一分钟内超过3次)。我的网站在反应用程序启动期间将数据加载到缓存中,以快速响应所有后续请求,但如果Appdomains每次都重新启动,则无法提供可接受的响应时间

关闭原因的值很多:

  • 构型改变
  • 寄宿环境
  • CodeDirChangeOrDirectoryRename
  • bindirchangerdirectyrename
  • BrowsersDirchangeDirctoryRename
这没有意义,因为我没有更改这些文件夹中的任何文件

我已经在免费模式下测试了其中一个站点,运行速度非常快,并且没有任何意外的AppDomain重启

谢谢

更新:

我已将此代码包含在应用程序启动中,未检测到任何文件更改,AppDomain正在重新启动,并且再次

var monitorPath=HostingEnvironment.MapPath(“~/”);
Add(“watcher”,新的FileSystemWatcher(monitorPath));
fsw=(FileSystemWatcher)应用程序[“watcher”];
fsw.EnableRaisingEvents=true;
fsw.IncludeSubdirectories=true;
fsw.Changed+=fsw_Changed;
fsw.Created+=fsw_Created;
fsw.Deleted+=fsw_Deleted;
fsw.重命名+=fsw_重命名;
更新日期2013年7月15日:

使用ScottGu文章中的代码

我已将此记录:

_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=“Disabled”时,数据立即下降到正常值,与流量相符。

使用asp.net 4.5中的新设置fcnMode(似乎在4.0中工作),AppDomain停止重新启动


但是,现在的问题是,为什么azure网站(至少在我订阅的网站中)中的FileChangesMonitor会给出以下消息:

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中的一个错误,该错误仅影响北欧地区。

看起来您在应用程序的根文件夹及其子文件夹中执行了写入操作。我想您最好的办法是获取根文件夹中的文件列表以及修改时间,并仔细查看它们,以便找到触发重新启动的原因。我曾经亲自面对过这个问题,并通过消除写入来修复它。您是否使用FTP或Kudu VFS检查了/LogFiles文件夹?在这里,您将看到站点引发的任何异常。您可能在返回导致站点工作进程终止的内容后引发未经处理的异常。将发布配置文件中的详细信息告知我们,以便通过FTP连接或登录https://.scm.azurewbsites.net/vfs 使用Kudu VFS。您可以使用Kudu ZIP下载整个日志目录,如下所示:https://.scm.azurewebsites.net/zip/LogFilesThe 网站没有向磁盘写入任何字节,eventlog.xml只有一小部分异常:-(日志中没有任何未处理的异常。