2016-05-25 25 views
2

Dies ist meine erste Frage in SO, bitte entschuldige mich, wenn ich ein paar Grammatikfehler habe.IIS 7 Fehler: Kann ein Programm nicht ausführen. Der ausgeführte Befehl war csc.exe (ApplicationPoolIdentity default settings)

Problem Beschreibung:

Ich habe seit August auf IIS 7 (Windows Server 2008) & SQL Server 2008 R2 in mehrere Server installiert und bietet Firmen-Intranet-Management-Service 32-Bit-MVC 5-basierte CRUD Systeme laufen 2015. Seit Monaten laufen alle reibungslos ohne Probleme. Doch gestern fand ich, dass ich nicht Site-Stamm-Seite auf einem Server 172.16.1.101 mit dieser Nachricht zugreifen kann:

> Server Error in '/' Application. 

> [Win32Exception (0x80004005): Access is denied] 

>[ExternalException (0x80004005): Cannot execute a program. The command being executed was "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 a program. The command being executed was "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 a program. The command being executed was "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 

Hier ist ein Ereignisprotokoll, wenn die Ausnahme aufgetreten:

>IIS 7 Event Log 

>Event code: 3005 

>Event message: An unhandled exception has occurred. 

>Event time: 5/24/2016 1:42:08 PM 

>Event time (UTC): 5/24/2016 6:42:08 AM 

>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 a program. The command being executed was "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". 
    at System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() 
    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) 

>Cannot execute a program. The command being executed was "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". 
    at System.CodeDom.Compiler.Executor.ExecWaitWithCaptureUnimpersonated(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName, String trueCmdLine) 
    at System.CodeDom.Compiler.Executor.ExecWaitWithCapture(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName, String trueCmdLine) 
    at Microsoft.CSharp.CSharpCodeGenerator.Compile(CompilerParameters options, String compilerDirectory, String compilerExe, String arguments, String& outputFile, Int32& nativeReturnValue, String trueArgs) 
    at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames) 
    at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames) 
    at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile(CompilerParameters options, String[] fileNames) 
    at System.Web.Compilation.AssemblyBuilder.Compile() 
    at System.Web.Compilation.BuildProvidersCompiler.<PerformBuild>b__1(AssemblyBuilder assemblyBuilder) 
    at System.Threading.Tasks.Parallel.<>c__DisplayClass32`2.<PartitionerForEachWorker>b__30() 
    at System.Threading.Tasks.Task.InnerInvoke() 
    at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) 
    at System.Threading.Tasks.Task.<>c__DisplayClass11.<ExecuteSelfReplicating>b__10(Object param0) 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 
    at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() 
    at System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) 
    at System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) 
    at System.Web.Compilation.BuildManager.CompileResourcesDirectory() 
    at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() 

>Access is 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: at >System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() 
    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) 


>Custom event details: 

Manchmal zeigt die Meldung \ Temporäres ASP.NET Files \ tls-Verzeichnis anstelle von \ Temporary ASP.NET Files \ root-Verzeichnis.

Der IIS 7-Server wird standardmäßig im Standardzustand und im einzelnen Pool konfiguriert, ohne dass standardmäßig Webdienste ausgeführt werden (nur Basiskonfigurationen), einschließlich XML (De-) Serializer.

In erster Linie dachte ich, ich habe Erlaubnis Fehler auf IIS-System-Account, hatte ich Einstellung Berechtigung auf "Vollzugriff" ohne Erfolg.

So erwartet fehlende Datei Kompilierung auf serverseitige nach der Nachricht, versuchen, durch diesen Befehl

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"

liefert Fehler die cmdline Dateien manuell auf CMD zu kompilieren:

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' is too 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 the file specified. '

Won‘ Ich gab eine Google-Suche nach diesem Problem und ähnliche verwandte Probleme auf SO gefunden:

Problems publishing a website on smarterasp.net with csc.exe file included?

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

aber ich habe weder installiert „Microsoft.CodeDom.Providers.DotNetCompilerPlatform“ -Paket noch SOAP verwenden, wenn das Projekt für die Live-Server-Implementierungen kompilieren, und schon haben ‚identity impersonate =‚true‘‘ Attribut auf web.config ohne Erfolg.

Als Nächstes konfigurierte ich den IIS-Anwendungspool entsprechend der Site mit der Option "Erweiterte Einstellungen", änderte den Identitätsbereich von "ApplicationPoolIdentity" auf "LocalSystem" und interessanterweise ging YSOD beim Zugriff auf die Root-Seite verloren. Ich habe versucht, es wieder auf "ApplicationPoolIdentity" zu ändern und YSOD kehrte zurück.

Auch das Problem hat vorläufig von LocalSystem Identität gelöst, ich bin immer noch neugierig, warum der Fehler ohne Anzeichen von Systemfehlern aufgetreten ist. 2 Fragen, die ich hier stellen möchte:

  1. Kann jemand erklären, warum ApplicationPoolIdentity Option in diesem Fall nicht funktioniert?

  2. Welche Schritte kann ich ergreifen, um dieses Problem für andere Server zu verringern, selbst wenn die Standardeinstellungen und ApplicationPoolIdentity festgelegt sind?

tl; dr: Application mit Standardkonfiguration auf IIS 7-Servern gearbeitet, bis gestern hatte ich gestoßen YSOD oben weder mit XML Serializer auf einem Server beschrieben noch Web-Services angewendet, bitte helfen Sie mir entweder erklären oder beschreiben, was Problem ist bereits auf dem Server im Detail aufgetreten und Möglichkeiten, es zu mildern.

PS: Das "-" und "-" Zeichen sollte durch "\" auf dem geschriebenen Verzeichnispfad ersetzt werden.

+0

Auf welchem ​​.NET Framework haben Sie das Projekt erstellt? Und was ist die .NET Framework-Version, die Sie auf diesem IIS-Computer installiert haben? –

+0

Haben Sie das gleiche Problem. Das Wechseln der Identität zu NetworkService hat meine Website gerade jetzt wieder aktiviert (DANKE). Das letzte Mal, als ich einen Build gepusht habe, war direkt bevor du das gepostet hast. Vielleicht gab es irgendwann im Mai einen MS-Patch, der das verursacht? Hast du es jemals herausgefunden? – imjosh

Antwort

4

deinstallieren DotNetCompilerPlatform von nuget-Paketen

+0

Danke !!! Dies hat mich daran gehindert, die standardmäßige ASP.Net-Anwendungsvorlage aufgrund von Sicherheitsbedenken beim Ausführen von csc.exe auf einem freigegebenen IIS-Host zu veröffentlichen –