ExternalException (0x80004005): 无法执行程序

今天更新系统上传到阿里云服务器,报错如下:

“/”应用程序中的服务器错误。


组策略阻止了这个程序。要获取详细信息,请与系统管理员联系。

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.ComponentModel.Win32Exception: 组策略阻止了这个程序。要获取详细信息,请与系统管理员联系。

源错误: 

执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。


堆栈跟踪: 

[Win32Exception (0x80004005): 组策略阻止了这个程序。要获取详细信息,请与系统管理员联系。]

[ExternalException (0x80004005): 无法执行程序。所执行的命令为 "f:usrLocalUserqxw2309550136in
oslyncsc.exe" /shared /keepalive:"10" /noconfig  /fullpaths @"C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files
oot8726d835c1ae0133lx3hbi43.cmdline"。]
   System.CodeDom.Compiler.Executor.ExecWaitWithCaptureUnimpersonated(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName, String trueCmdLine) +6487183
   System.CodeDom.Compiler.Executor.ExecWaitWithCapture(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName, String trueCmdLine) +115
   System.CodeDom.Compiler.Executor.ExecWaitWithCapture(IntPtr userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName) +59
   Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.Compile(CompilerParameters options, String compilerFullPath, String arguments, String& outputFile, Int32& nativeReturnValue) +193
   Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.FromFileBatch(CompilerParameters options, String[] fileNames) +680
   Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames) +186
   System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile(CompilerParameters options, String[] fileNames) +23
   System.Web.Compilation.AssemblyBuilder.Compile() +884
   System.Web.Compilation.BuildProvidersCompiler.PerformBuild() +9520058
   System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +9950660
   System.Web.Compilation.BuildManager.CompileGlobalAsax() +44
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +269

[HttpException (0x80004005): 无法执行程序。所执行的命令为 "f:usrLocalUserqxw2309550136in
oslyncsc.exe" /shared /keepalive:"10" /noconfig  /fullpaths @"C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files
oot8726d835c1ae0133lx3hbi43.cmdline"。]
   System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +62
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +427
   System.Web.Compilation.BuildManager.CallAppInitializeMethod() +31
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +535

[HttpException (0x80004005): 无法执行程序。所执行的命令为 "f:usrLocalUserqxw2309550136in
oslyncsc.exe" /shared /keepalive:"10" /noconfig  /fullpaths @"C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files
oot8726d835c1ae0133lx3hbi43.cmdline"。]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9952212
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

 


版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.34280

这个错误在本地测试是没有的。

我所使用的开发工具是vs2015。

当我发布到阿里云虚拟主机时报的错。

经过百度没有找到解决方案,又用bing终于在stackoverflow上找到了解决方案。解决方案如下:

  1. Open NuGet Package Manager window
  2. uninstall Microsoft.CodeDom.Providers.DotNetCompilerPlatform package and rebuild & republish. (This uninstallation also removes CodeDom configuration from web.config file.)

意思就是打开nuget,然后卸载Microsoft.CodeDom.Providers.DotNetCompilerPlatform 包,重新编译发布。

详细参考:https://stackoverflow.com/questions/35184429/problems-publishing-a-website-on-smarterasp-net-with-csc-exe-file-included/35207055#35207055

我是通过这种方式解决的。

原文地址:https://www.cnblogs.com/eggTwo/p/10587211.html