Joseph Campbell
Joseph Campbell

Reputation: 330

Server Error in '/' Application Access is denied

This is a continuation of a question I asker earlier, but that after I solved I got immediately stuck again

My Asp.net Mvc application is not loading I run it browse to it in IIS, instead I get the following

enter image description here

Stack Trace

[Win32Exception (0x80004005): Access is denied]

[ExternalException (0x80004005): Cannot execute a program. The command being executed was "C:\Users\JoeCampbell\source\repos\webapi\bin\roslyn\csc.exe" /shared /keepalive:"10" /noconfig /fullpaths @"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\f66da336\3058efba\3w2ezdih.cmdline".]
System.CodeDom.Compiler.Executor.ExecWaitWithCaptureUnimpersonated(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName, String trueCmdLine) +1767 System.CodeDom.Compiler.Executor.ExecWaitWithCapture(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName, String trueCmdLine) +208 System.CodeDom.Compiler.Executor.ExecWaitWithCapture(IntPtr userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName) +125
Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.Compile(CompilerParameters options, String compilerFullPath, String arguments, String& outputFile, Int32& nativeReturnValue) +413
Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.FromFileBatch(CompilerParameters options, String[] fileNames) +857
Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames) +185
System.Web.Compilation.AssemblyBuilder.Compile() +1869
System.Web.Compilation.BuildProvidersCompiler.PerformBuild() +306
System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +330
System.Web.Compilation.BuildManager.CompileGlobalAsax() +49
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +327

[HttpException (0x80004005): Cannot execute a program. The command being executed was "C:\Users\JoeCampbell\source\repos\webapi\bin\roslyn\csc.exe" /shared /keepalive:"10" /noconfig /fullpaths @"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\f66da336\3058efba\3w2ezdih.cmdline".]
System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +73 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +603 System.Web.Compilation.BuildManager.CallAppInitializeMethod() +36
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +831

[HttpException (0x80004005): Cannot execute a program. The command being executed was "C:\Users\JoeCampbell\source\repos\webapi\bin\roslyn\csc.exe" /shared /keepalive:"10" /noconfig /fullpaths @"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\f66da336\3058efba\3w2ezdih.cmdline".]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +688

Things I have tried

Upvotes: 1

Views: 4328

Answers (2)

Howie Krauth
Howie Krauth

Reputation: 51

I had this same error, telling me that access was denied to a file in a folder on the desktop ("C:\Users<myusername>\Desktop\bin\roslyn\csc.exe"). When I changed permissions to that folder, the problem got worse (website cannot be reached). I was confused as to why it was trying to access a folder on my user desktop. The solution for me was to change permissions on the same sub folder within the project solution folder (in my case, "F:\VS\WebApps<solution name><solution name>\bin\roslyn").

Upvotes: 0

Joseph Campbell
Joseph Campbell

Reputation: 330

I solved this by going to the folder listed in the stack trace and giving full permissions to webapi.localhost.net, however for you this is going to be your application pool identity.

For me it was in

"C:\Users\JoeCampbell\source\repos\webapi\bin\roslyn\csc.exe"

I then right clicked the folder > Properties > Security >

Click your application pool identity within "Group or user names:"

Click edit, and then grant Full control

Click OK

enter image description here

Upvotes: 2

Related Questions