%3CLINGO-SUB%20id%3D%22lingo-sub-945340%22%20slang%3D%22en-US%22%3EThe%20file%20has%20not%20been%20pre-compiled%20error%20and%20solution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-945340%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20intermittent%20error%20may%20show%20up%20in%20Event%20Viewer%20when%20your%20application%20fails%20to%20load%3A%20%E2%80%9C%3CSTRONG%3EThe%20file%20has%20not%20been%20pre-compiled%2C%20and%20cannot%20be%20requested%3C%2FSTRONG%3E%E2%80%9D.%20The%20intermittent%20nature%20of%20the%20issue%20makes%20it%20difficult%20to%20troubleshoot%20it%20but%20there%20are%20a%20couple%20of%20possible%20root%20causes%20and%20solutions.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1652317811%22%20id%3D%22toc-hId-1652317811%22%3EThe%20error%20message%3C%2FH3%3E%0A%3CP%3EHere%20is%20the%20full%20error%20message%20from%20Event%20Viewer%20(Event%20ID%20is%201309)%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CFONT%20size%3D%222%22%3EEvent%20code%3A%203005%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3EEvent%20message%3A%20An%20unhandled%20exception%20has%20occurred.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CFONT%20size%3D%222%22%3E%3CSTRONG%3EApplication%20information%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3EApplication%20domain%3A%20%2FLM%2FW3SVC%2F1%2FROOT%2FApplicationX-1-132102041647233704%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3ETrust%20level%3A%20Full%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3EApplication%20Virtual%20Path%3A%20%2FApplicationX%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3EApplication%20Path%3A%20E%3A%5Cinetpub%5Cwwwroot%5CApplicationX%5C%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3EMachine%20name%3A%20ServerX%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CFONT%20size%3D%222%22%3E%3CSTRONG%3EProcess%20information%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3EProcess%20ID%3A%202276%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3EProcess%20name%3A%20w3wp.exe%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3EAccount%20name%3A%20NT%20AUTHORITY%5CNETWORK%20SERVICE%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CFONT%20size%3D%222%22%3E%3CSTRONG%3EException%20information%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3EException%20type%3A%20HttpException%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3EException%20message%3A%20The%20file%20%E2%80%98%2FApplicationX%2FLogin.aspx%E2%80%99%20has%20not%20been%20pre-compiled%2C%20and%20cannot%20be%20requested.%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3Eat%20System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath%20virtualPath%2C%20Boolean%20noBuild%2C%20Boolean%20allowCrossApp%2C%20Boolean%20allowBuildInPrecompile%2C%20Boolean%20throwIfNotFound%2C%20Boolean%20ensureIsUpToDate)%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3Eat%20System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext%20context%2C%20VirtualPath%20virtualPath%2C%20Boolean%20noBuild%2C%20Boolean%20allowCrossApp%2C%20Boolean%20allowBuildInPrecompile%2C%20Boolean%20throwIfNotFound%2C%20Boolean%20ensureIsUpToDate)%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_0.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F146951i863BEB7DB8F27D8A%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22clipboard_image_0.jpeg%22%20alt%3D%22clipboard_image_0.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--899839150%22%20id%3D%22toc-hId--899839150%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22toc-hId-842971185%22%20id%3D%22toc-hId-842971185%22%3ESolution%3C%2FH3%3E%0A%3CP%3EIn%20most%20cases%2C%20the%20root%20cause%20of%20the%20issue%20is%20that%20the%20application%20is%20not%20able%20to%20load%20one%20or%20more%20libraries.%20An%20assembly%20that%20web.config%20references%20is%20probably%20not%20available%20in%20the%20application%20directory%20or%20GAC.%3C%2FP%3E%0A%3CP%3EThe%20most%20common%20causes%20of%20this%20error%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EThere%20is%20a%20known%20bug%20in%26nbsp%3B%3CSTRONG%3E.NET%20Framework%204.7.x%3C%2FSTRONG%3E%26nbsp%3Bthat%20causes%20this%20issue%3C%2FLI%3E%0A%3CLI%3EWeb.config%20file%20references%20an%20assembly%20that%20doesn%E2%80%99t%20exist%20in%20the%20application%20folder%20or%20GAC%3C%2FLI%3E%0A%3CLI%3EAn%20assembly%20file%20that%20exists%20in%20the%20application%20folder%20is%20not%20referenced%20by%20the%20web.config%20file%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20the%202nd%20and%203rd%20causes%2C%20Turning%20on%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FIIS-Support-Blog%2FFusion-Log-Viewer-fuslogvw-exe%2Fba-p%2F784396%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EAssembly%20Binding%20Logging%3C%2FA%3E%20helps%20finding%20which%20assembly%20is%20causing%20this%20issue.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOther%20possible%20causes%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EIncorrect%20version%20of%20the%20assemblies%20that%20are%20being%20used%3C%2FLI%3E%0A%3CLI%3EPrecompiledApp.config%26nbsp%3Bfile%20exists%20in%20the%20application%20folder%3C%2FLI%3E%0A%3CLI%3EIt%E2%80%99s%20a%2032-bit%20application%20and%20%E2%80%9C%3CSTRONG%3EEnable%2032-bit%20applications%3C%2FSTRONG%3E%E2%80%9D%20is%20set%20to%20false%3C%2FLI%3E%0A%3CLI%3ETemporary%20ASP.NET%20files%20may%20be%20causing%20the%20issue%20(C%3A%5CWINDOWS%5CMicrosoft.NET%5CFramework%5Cv4.0.30319%5CTemporary%20ASP.NET%20Files%5Croot)%3C%2FLI%3E%0A%3CLI%3EThere%20are%20extra%20files%20in%20the%20publish%20location%20(%E2%80%9CRemove%20additional%20files%20at%20destination%E2%80%9D%20is%20not%20selected%20in%20the%20Visual%20Studio%20Publish%20Profile)%3C%2FLI%3E%0A%3CLI%3EThe%20script%20used%20for%20deployment%20may%20not%20be%20clearing%20the%20destination%20folder%20properly%20or%20it%20may%20not%20be%20copying%20all%20the%20files%3C%2FLI%3E%0A%3CLI%3EThere%20is%20not%20enough%20disk%20space%20in%20IIS%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_1.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F146950i7999A6592A2B75F7%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22clipboard_image_1.png%22%20alt%3D%22clipboard_image_1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3EPublish%20options%20in%20Visual%20Studio%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20won%E2%80%99t%20be%20able%20to%20provide%20solution%20for%20each%20of%20these%20causes%20but%20I%20am%20hoping%20that%20knowing%20these%20possible%20causes%20will%20help%20narrowing%20the%20issue%20down.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20are%20a%20helpful%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fforums.asp.net%2Ft%2F956297.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EASP.NET%20forum%20topic%3C%2FA%3E%20and%20a%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fblogs.msdn.microsoft.com%2Fasiatech%2F2009%2F06%2F12%2Fthe-file-xxxxxx-aspx-has-not-been-pre-compiled-and-cannot-be-requested%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EMSDN%20blog%20post%3C%2FA%3E%26nbsp%3Babout%20this%20issue.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-945340%22%20slang%3D%22en-US%22%3E%3CP%20style%3D%22margin%3A%200cm%200cm%207.5pt%200cm%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2013.5pt%3B%20font-family%3A%20'Arial'%2Csans-serif%3B%20color%3A%20%236b6b6b%3B%22%3EThis%20intermittent%20error%20may%20show%20up%20in%20Event%20Viewer%20when%20your%20application%20fails%20to%20load%3A%20%E2%80%9CThe%20file%20has%20not%20been%20pre-compiled%2C%20and%20cannot%20be%20requested%E2%80%9D.%20The%20intermittent%20nature%20of%20the%20issue%20makes%20it%20difficult%20to%20troubleshoot%20it%20but%20there%20are%20a%20couple%20of%20possible%20root%20causes%20and%20solutions.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Microsoft

This intermittent error may show up in Event Viewer when your application fails to load: “The file has not been pre-compiled, and cannot be requested”. The intermittent nature of the issue makes it difficult to troubleshoot it but there are a couple of possible root causes and solutions.

The error message

Here is the full error message from Event Viewer (Event ID is 1309):

 

Event code: 3005
Event message: An unhandled exception has occurred.

Application information:
Application domain: /LM/W3SVC/1/ROOT/ApplicationX-1-132102041647233704
Trust level: Full
Application Virtual Path: /ApplicationX
Application Path: E:\inetpub\wwwroot\ApplicationX\
Machine name: ServerX

Process information:
Process ID: 2276
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE

Exception information:
Exception type: HttpException
Exception message: The file ‘/ApplicationX/Login.aspx’ has not been pre-compiled, and cannot be requested.
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)

 

clipboard_image_0.jpeg

 

Solution

In most cases, the root cause of the issue is that the application is not able to load one or more libraries. An assembly that web.config references is probably not available in the application directory or GAC.

The most common causes of this error:

  1. There is a known bug in .NET Framework 4.7.x that causes this issue
  2. Web.config file references an assembly that doesn’t exist in the application folder or GAC
  3. An assembly file that exists in the application folder is not referenced by the web.config file

 

For the 2nd and 3rd causes, Turning on Assembly Binding Logging helps finding which assembly is causing this issue.

 

Other possible causes:

  1. Incorrect version of the assemblies that are being used
  2. PrecompiledApp.config file exists in the application folder
  3. It’s a 32-bit application and “Enable 32-bit applications” is set to false
  4. Temporary ASP.NET files may be causing the issue (C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root)
  5. There are extra files in the publish location (“Remove additional files at destination” is not selected in the Visual Studio Publish Profile)
  6. The script used for deployment may not be clearing the destination folder properly or it may not be copying all the files
  7. There is not enough disk space in IIS

 

clipboard_image_1.png

Publish options in Visual Studio

 

I won’t be able to provide solution for each of these causes but I am hoping that knowing these possible causes will help narrowing the issue down.

 

Here are a helpful ASP.NET forum topic and a MSDN blog post about this issue.