只有在应用程序池回收后,MVC应用程序上才会出现CheckVirtualFileExists异常

时间:2023-01-04 20:28:02

I get the following exception when accessing any URL (route) after a recycle of the App Pool on an otherwise trouble-free ASP.NET MVC 3 web application that is under heavy use.

在一个没有问题的ASP上,在应用程序池被回收后,当访问任何URL(路由)时,我得到以下异常。正在大量使用的netmvc 3 web应用程序。

The facts:

事实说话:

  • IIS 7
  • IIS 7
  • .NET 4.0 Classic Mode Application Pool (only application in the pool)
  • .NET 4.0经典模式应用程序池(仅在池中应用)
  • accessed via HTTPS as a back-end web-service by other applications
  • 通过HTTPS作为后端web服务通过其他应用程序访问。
  • no code changes, site was undergoing regular 29 hour automatic recycles on the same code for years, automatic recycle is now disabled to keep the site up
  • 没有代码更改,站点正在进行定期29小时的自动回收,在相同的代码上进行多年,自动回收现在被禁用以保持站点的正常运行
  • App Pool recycle (or server restart) causes the site to fail
  • 应用程序池回收(或服务器重新启动)导致站点失败
  • Must redeploy site (copy all files/folders from pre-compile build into physical path) to get it working again after a recycle
  • 必须重新部署站点(将预编译的所有文件/文件夹复制到物理路径中)以使其在循环后再次工作?
  • we are catching/logging the error in the Application_Error method
  • 我们正在捕获/记录Application_Error方法中的错误
  • No unhandled exceptions in event log
  • 事件日志中没有未处理的异常
  • Any attempt to access any route/URL generates the exception
  • 任何访问任何路由/URL的尝试都会产生异常。

Details:

细节:

HTTPErr Example: 2015-02-05 08:43:36 66.XXX.XXX.14 32224 10.XXX.XXX.185 443 HTTP/1.1 POST /IdentityToken/Endpoint.aspx - 6 Connection_Abandoned_By_ReqQueue MOBILEWEBSERVICE
Exception:
Timestamp: 2/5/2015 4:21:03 AM
Message: HandlingInstanceID: 438c9949-1ad2-49c4-9c7c-928bce03fd37
<Exception>
  <Description>An exception of type 'System.Web.HttpException' occurred and was caught.</Description>
  <DateTime>2015-02-05 04:21:03Z</DateTime>
  <ExceptionType>System.Web.HttpException, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</ExceptionType>
  <Message>The file '/Policies/Endpoint.aspx' does not exist.</Message>
  <Source>System.Web</Source>
  <HelpLink />
  <Property name="WebEventCode">0</Property>
  <Property name="ErrorCode">-2147467259</Property>
  <Property name="Data">System.Collections.ListDictionaryInternal</Property>
  <Property name="TargetSite">Void CheckVirtualFileExists(System.Web.VirtualPath)</Property>
  <Property name="HResult">-2147467259</Property>
  <StackTrace>   at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
   at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
   at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
   at System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
   at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
   at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)</StackTrace>
  <additionalInfo>
    <info name="MachineName" value="SERVERNAME" />
    <info name="TimeStamp" value="2/5/2015 9:21:03 AM" />
    <info name="FullName" value="Legacy, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null" />
    <info name="AppDomainName" value="/LM/W3SVC/6/ROOT-1-130676015007079933" />
    <info name="ThreadIdentity" value="" />
    <info name="WindowsIdentity" value="IIS APPPOOL\MOBILEWEBSERVICE" />
  </additionalInfo>
</Exception>

只有在应用程序池回收后,MVC应用程序上才会出现CheckVirtualFileExists异常

1 个解决方案

#1


1  

To debug CheckFileExists, you may wanna use something like this:

要调试CheckFileExists,您可能需要使用以下内容:

string fileName = "Test.aspx";
bool IsExistFile = System.IO.File.Exists(Server.MapPath("./") + fileName);

if (IsExistFile)
    Response.Write("Find the file!");
else Response.Write("The file is not exist!");

#1


1  

To debug CheckFileExists, you may wanna use something like this:

要调试CheckFileExists,您可能需要使用以下内容:

string fileName = "Test.aspx";
bool IsExistFile = System.IO.File.Exists(Server.MapPath("./") + fileName);

if (IsExistFile)
    Response.Write("Find the file!");
else Response.Write("The file is not exist!");