Fix: Random FileNotFoundException in ASP.Net 2.0 application


Issue  -  Random FileNotFoundException when browsing ASP.Net 2.0 application.  An event similar to the following will be logged in the event viewer.  The file name in the exception is typically different every time:


Exception message: Could not load file or assembly 'App_Web_-a8debde, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

  Stack trace:    at ASP.UserControl_ascx.__BuildControlmain()
   at ASP.UserControl_ascx.__BuildControlTree(dynamic_default_ascx __ctrl)
   at ASP.UserControl_ascx.FrameworkInitialize()
   at System.Web.UI.UserControl.InitializeAsUserControlInternal()
   at System.Web.UI.UserControl.InitializeAsUserControl(Page page)
   at ASP.default_aspx.__BuildControlhtml_content()
   at ASP.default_aspx.__BuildControlTree(default_aspx __ctrl)
   at ASP.default_aspx.FrameworkInitialize()
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.default_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Workarounds  -  In some cases, it's necessary to clear the Temporary ASP.Net Files folder and restart the application pool.  We've found in some cases that setting batch="false" in the web.config file will resolve the issue as well, however, there are some perf reasons for not doing that long term in production.


Getting the Fix  -  The KB for this fix is not yet public (I'll link it as soon as it is), however, the fix is available.  You will need to contact Microsoft Support (http://support.microsoft.com/) and ask for the fix from KB article 934839.

Comments (4)
  1. roy_huntley says:

    Hi. Just received this error message on my asp.net 2 application and have requested the hotfix. Is this likely to fix another similar error, detailed below:

    Exception information:

       Exception type: IOException

       Exception message: An attempt was made to reference a token that does not exist.

       Thread account name: GBLOND088S9BASPNET

       Is impersonating: False

       Stack trace:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

      at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)

      at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)

      at System.Web.Hosting.MapPathBasedVirtualFile.Open()

      at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)

      at System.Web.UI.TemplateParser.ParseInternal()

      at System.Web.UI.TemplateParser.Parse()

      at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()

      at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)

      at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()

      at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()

      at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)

      at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)

      at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)

      at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath)

      at System.Web.UI.TemplateControl.LoadControl(String virtualPath)

      at ABNAmro.MATWeb.DesktopDefault.Page_Init(Object sender, EventArgs e)

      at System.Web.UI.Control.OnInit(EventArgs e)

      at System.Web.UI.Page.OnInit(EventArgs e)

      at System.Web.UI.Control.InitRecursive(Control namingContainer)

      at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

  2. Jerry_Orman says:

    Does the exception logged have the path that is being accessed?  If it is and the path points to Temporary ASP.Net Files directory, it’s possible, but I haven’t seen that particular exception to be 100% positive.

    From the stack, the process is calling Page_Init on DesktopDefault.aspx, this calls LoadControl which gets into compilation code that eventually tries to create a filestream to a path.  Creating the filestream is failing with the exception.

    If there is no path in the exception and you can consistently repro, possible that running Process Monitor when the problem reproduces would help determine why that exception is occurring.  

  3. manso says:

    Hi, we downloaded and tried to apply this fix but the installer said it couldn’t find the products neccessary in order to apply the hotfix. We have VS 2005 SP1 (KB926601) and VS 2005 Vista SP1 (KB932232) installed. Are you aware of any problems related to this?

    Thanks

  4. Jerry_Orman says:

    The fix isn’t dependent on the Visual Studio client, however, since the 2.0 framework is shipped as part of the Vista OS, it needs a different install package.  We currently have a request in to get the updated package built.

Comments are closed.

Skip to main content