locked
ASP.NET MVC - JIT compile error - The file [.cshtmls file] has not been pre-compiled, and cannot be requested RRS feed

  • Question

  • User200042610 posted

    We have a pre-compiled MVC application that is seeing the 'The file [.cshtmls file] has not been pre-compiled, and cannot be requested' errors periodically. What we have found is that in the C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\<application name in IIS> directory, there are files with names similar to 'App_web__contenttitle.cshtml.639c3968.dll.delete' that when deleted, the error goes away and the application starts working again. If this file is not deleted, the application will not run. It appears these files are created as part of the JIT compile on app startup, and that the JIT compilation should be removing these files, but for some reason isn't removing them sometimes. We believe virus scanners on the server could potentially be locking these files, preventing them from being deleted. However, we have also seen this behavior happen even when virus scanners add the location to their exception list. 

    We believe this is currently happening on .NET Framework versions 4.5 to 4.7, these are the current versions run on various deployments. 

    Is there another reason these *.delete files might be hanging around causing problems? Should we look into using NGen.exe to do the compilation instead of JIT?

    Thursday, January 28, 2021 2:58 PM

All replies

  • User475983607 posted

    I've seen this situation when deploying over a running application.  

    Thursday, January 28, 2021 3:00 PM
  • User200042610 posted

    Thanks! Our deployment tool is supposed to stop IIS before deploying, but that gives me something to look into, maybe that tool has a bug with that or something.

    Thursday, January 28, 2021 3:43 PM