Sean Anderson
Sean Anderson

Reputation: 660

CheckVirtualFileExists exception on MVC app only after App Pool Recycle

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.

The facts:

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>

enter image description here

Upvotes: 3

Views: 3416

Answers (1)

Amirhossein Mehrvarzi
Amirhossein Mehrvarzi

Reputation: 18954

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

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!");

Upvotes: 1

Related Questions