c# - IIS 7 Error: Cannot execute a program. The command being executed was csc.exe (ApplicationPoolIdentity default settings) -


this first question in so, please apologize me if have grammatical mistakes.

problem description:

i have 32-bit mvc 5-based crud systems running on iis 7 (windows server 2008) & sql server 2008 r2 installed several servers, providing company intranet management service since august 2015. months, of them running smoothly without problems. however, yesterday found cannot access site root page on 172.16.1.101 server message:

> server error in '/' application.  > [win32exception (0x80004005): access denied]  >[externalexception (0x80004005): cannot execute program. command being executed "c:\windows\microsoft.net\framework\v4.0.30319\csc.exe" /noconfig /fullpaths @"c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net files\root\-(random 8-digit hex)-\-(random 8-digit hex)-\-(random 8-char base64).cmdline".] system.codedom.compiler.executor.execwaitwithcaptureunimpersonated(safeusertokenhandle usertoken, string cmd, string currentdir, tempfilecollection tempfiles, string& outputname, string& errorname, string truecmdline) +3365 system.codedom.compiler.executor.execwaitwithcapture(safeusertokenhandle usertoken, string cmd, string currentdir, tempfilecollection tempfiles, string& outputname, string& errorname, string truecmdline) +8591876 microsoft.csharp.csharpcodegenerator.compile(compilerparameters options, string compilerdirectory, string compilerexe, string arguments, string& outputfile, int32& nativereturnvalue, string trueargs) +331 microsoft.csharp.csharpcodegenerator.fromfilebatch(compilerparameters options, string[] filenames) +784 microsoft.csharp.csharpcodegenerator.system.codedom.compiler.icodecompiler.compileassemblyfromfilebatch(compilerparameters options, string[] filenames) +170 system.web.compilation.assemblybuilder.compile() +12440424 system.web.compilation.buildproviderscompiler.performbuild() +303 system.web.compilation.applicationbuildprovider.getglobalasaxbuildresult(boolean isprecompiledapp) +12978145 system.web.compilation.buildmanager.compileglobalasax() +50 system.web.compilation.buildmanager.ensuretoplevelfilescompiled() +665  >[httpexception (0x80004005): cannot execute program. command being executed "c:\windows\microsoft.net\framework\v4.0.30319\csc.exe" /noconfig /fullpaths @"c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net files\root\-(random 8-digit hex)-\-(random 8-digit hex)-\-(random 8-char base64)-.cmdline".] system.web.compilation.buildmanager.reporttoplevelcompilationexception() +80 system.web.compilation.buildmanager.ensuretoplevelfilescompiled() +1142 system.web.hosting.hostingenvironment.initialize(applicationmanager appmanager, iapplicationhost apphost, iconfigmappathfactory configmappathfactory, hostingenvironmentparameters hostingparameters, policylevel policylevel, exception appdomaincreationexception) +1193  >[httpexception (0x80004005): cannot execute program. command being executed "c:\windows\microsoft.net\framework\v4.0.30319\csc.exe" /noconfig /fullpaths @"c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net files\root\-(random 8-digit hex)-\-(random 8-digit hex)-\-(random 8-char base64)-.cmdline".] system.web.httpruntime.firstrequestinit(httpcontext context) +12980692 system.web.httpruntime.ensurefirstrequestinit(httpcontext context) +159 system.web.httpruntime.processrequestnotificationprivate(iis7workerrequest wr, httpcontext context) +12820285 

here event log when exception occured:

>iis 7 event log  >event code: 3005   >event message: unhandled exception has occurred.   >event time: 5/24/2016 1:42:08 pm   >event time (utc): 5/24/2016 6:42:08   >event id: 062751a2dc724be9af5de99014e58a47   >event sequence: 2   >event occurrence: 1   >event detail code: 0   >application information:   >application domain: /lm/w3svc/3/root-1-131085457263004464   >trust level: full   >application virtual path: /   >application path: e:\test\   >machine name: -- edited --  >process information:   >process id: 1172  >process name: w3wp.exe   >account name: iis apppool\asp.net v4.0   >exception information:  >exception type: httpexception  >exception message: cannot execute program. command being executed "c:\windows\microsoft.net\framework\v4.0.30319\csc.exe" /noconfig /fullpaths @"c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net files\root\-(random 8-digit hex)-\-(random 8-digit hex)-\-(random 8-char base64)-.cmdline".    @ system.web.compilation.buildmanager.reporttoplevelcompilationexception()    @ system.web.compilation.buildmanager.ensuretoplevelfilescompiled()    @ system.web.compilation.buildmanager.callappinitializemethod()    @ system.web.hosting.hostingenvironment.initialize(applicationmanager appmanager, iapplicationhost apphost, iconfigmappathfactory configmappathfactory, hostingenvironmentparameters hostingparameters, policylevel policylevel, exception appdomaincreationexception)  >cannot execute program. command being executed "c:\windows\microsoft.net\framework\v4.0.30319\csc.exe" /noconfig /fullpaths @"c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net files\root\-(random 8-digit hex)-\-(random 8-digit hex)-\-(random 8-char base64).cmdline".    @ system.codedom.compiler.executor.execwaitwithcaptureunimpersonated(safeusertokenhandle usertoken, string cmd, string currentdir, tempfilecollection tempfiles, string& outputname, string& errorname, string truecmdline)    @ system.codedom.compiler.executor.execwaitwithcapture(safeusertokenhandle usertoken, string cmd, string currentdir, tempfilecollection tempfiles, string& outputname, string& errorname, string truecmdline)    @ microsoft.csharp.csharpcodegenerator.compile(compilerparameters options, string compilerdirectory, string compilerexe, string arguments, string& outputfile, int32& nativereturnvalue, string trueargs)    @ microsoft.csharp.csharpcodegenerator.fromfilebatch(compilerparameters options, string[] filenames)    @ microsoft.csharp.csharpcodegenerator.system.codedom.compiler.icodecompiler.compileassemblyfromfilebatch(compilerparameters options, string[] filenames)    @ system.codedom.compiler.codedomprovider.compileassemblyfromfile(compilerparameters options, string[] filenames)    @ system.web.compilation.assemblybuilder.compile()    @ system.web.compilation.buildproviderscompiler.<performbuild>b__1(assemblybuilder assemblybuilder)    @ system.threading.tasks.parallel.<>c__displayclass32`2.<partitionerforeachworker>b__30()    @ system.threading.tasks.task.innerinvoke()    @ system.threading.tasks.task.innerinvokewitharg(task childtask)    @ system.threading.tasks.task.<>c__displayclass11.<executeselfreplicating>b__10(object param0) --- end of stack trace previous location exception thrown ---    @ system.runtime.exceptionservices.exceptiondispatchinfo.throw()    @ system.web.compilation.buildproviderscompiler.performbuild()    @ system.web.compilation.codedirectorycompiler.getcodedirectoryassembly(virtualpath virtualdir, codedirectorytype dirtype, string assemblyname, stringset excludedsubdirectories, boolean isdirectoryallowed)    @ system.web.compilation.buildmanager.compilecodedirectory(virtualpath virtualdir, codedirectorytype dirtype, string assemblyname, stringset excludedsubdirectories)    @ system.web.compilation.buildmanager.compileresourcesdirectory()    @ system.web.compilation.buildmanager.ensuretoplevelfilescompiled()  >access denied  >request information:  >request url: //172.16.1.101/  >request path: /  >user host address: //172.16.1.101  >user:  >is authenticated: false  >authentication type:  >thread account name: iis apppool\asp.net v4.0  >thread information:  >thread id: 5  >thread account name: iis apppool\asp.net v4.0  >is impersonating: true  >stack trace:    @ >system.web.compilation.buildmanager.reporttoplevelcompilationexception()    @ system.web.compilation.buildmanager.ensuretoplevelfilescompiled()    @ system.web.compilation.buildmanager.callappinitializemethod()    @ system.web.hosting.hostingenvironment.initialize(applicationmanager appmanager, iapplicationhost apphost, iconfigmappathfactory configmappathfactory, hostingenvironmentparameters hostingparameters, policylevel policylevel, exception appdomaincreationexception)   >custom event details:  

sometimes message shows \temporary asp.net files\tls directory, rather \temporary asp.net files\root directory.

the iis 7 server configured in default state , single pool without running web services default (only basic configurations), including xml (de-)serializer.

primarily thought have permission error on iis system account, had done setting permission "full control" without success.

thus, expected missing file compilation on server-side according message, trying compile cmdline files manually on cmd command

csc.exe /noconfig /fullpaths @"c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net files\root-(random 8-digit hex)--(random 8-digit hex)--(random 8-char base64).cmdline"

provides error:

fatal error cs2021: file name '@c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net files\root-(random 8-digit hex)--(random 8-digit hex)--(random 8-char base64).cmdline' long or invalid

error cs2011: error opening response file 'c:\windows\microsoft.net\framework\v4.0.30319\root-(random 8-digit hex)--(random 8-digit hex)--(random 8-char base64).cmdline' -- 'the system cannot find file specified. '

won't giving up, conducted google search problem , found related similar problems on so:

problems publishing website on smarterasp.net csc.exe file included?

https://stackoverflow.com/questions/37146958/an-unhandled-exception-was-generated-during-the-execution-of-the-current-web-re

however, have neither installed "microsoft.codedom.providers.dotnetcompilerplatform" package nor using soap when compiling project live server implementations, , have 'identity impersonate="true"' attribute on web.config no avail.

next, configured iis application pool corresponding site "advanced settings" option, changing identity section "applicationpoolidentity" "localsystem" , interestingly ysod on accessing root page went away. tried change on "applicationpoolidentity" , ysod turned back.

even problem has temporarily solved localsystem identity, still curious why error occurred without signs of system malfunction. 2 questions want ask here:

  1. can explain why applicationpoolidentity option didn't work on case?

  2. which steps can take mitigate issue other servers, default settings , applicationpoolidentity set?

tl;dr: applicationpoolidentity default configuration on iis 7 servers worked until yesterday had encountered ysod described above on server neither xml serializers nor web services applied, please me either explain or describe problem happened on server in detail , ways mitigate it.

ps: "-" , "--" sign should replaced "\" on written directory path.

uninstall dotnetcompilerplatform nuget packages


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -