HttpCompileException error when browsing web application

If you setup a new web application on new application server, you may encounter following error when you browse your web application.  If you look at the error message, it says that it could not write to output file ‘c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET\…’ because it doesn’t have an access.  That error message is misleading.  To resolve the issue, you need to give IIS_IUSRS group read/write permission to c:\windows\temp folder.

Following error is logged in event viewer.

Event code: 3007
Event message: A compilation error has occurred.
Event ID: c831b41f34e6429e97b00e8029af21f2
Event sequence: 3
Event occurrence: 1
Event detail code: 0

Exception information:
Exception type: HttpCompileException
Exception message: (0): error CS0016: Could not write to output file ‘c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\66385af8\7d666d38\App_global.asax.8hwnb8gl.dll’ — ‘Access is denied. ‘
at System.Web.Compilation.AssemblyBuilder.Compile()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp)
at System.Web.Compilation.BuildManager.CompileGlobalAsax()
at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
at System.Web.Compilation.BuildManager.CallAppInitializeMethod()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)


Hope this helps!

Posted in Microsoft Technology Tagged with: