简体   繁体   English

面向.NET 4.6.1的ASP.NET Core 2.0应用无法在IIS上托管

[英]ASP.NET Core 2.0 app targeting .NET 4.6.1 fails to host on IIS

The problem 问题

IIS ASP.NET Core module is unable to start an ASP.NET Core 2.0 app. IIS ASP.NET Core模块无法启动ASP.NET Core 2.0应用程序。

Browser: HTTP Error 502.5 - Process Failure 浏览器: HTTP错误502.5-进程失败

Windows Event Log: Application ' MACHINE/WEBROOT/APPHOST/AppSite ' with physical root ' C:\\inetpub\\apps\\AppFolder\\ ' failed to start process with commandline ' C:\\inetpub\\apps\\AppFolder\\App.exe ', ErrorCode = ' 0x80004005: 1 '. Windows事件日志:具有物理根目录“ C:\\inetpub\\apps\\AppFolder\\ ”的应用程序“ MACHINE/WEBROOT/APPHOST/AppSite ”无法通过命令行“ C:\\inetpub\\apps\\AppFolder\\App.exe ”启动进程,ErrorCode =' 0x80004005: 1 '。

ASP.NET Core Module Log: Log file is created but is empty. ASP.NET Core模块日志:日志文件已创建但为空。


The setup 设置

App: ASP.NET Core 2.0 targeting .NET Framework 4.6.1. 应用:针对.NET Framework 4.6.1的ASP.NET Core 2.0。

Server: Windows Server 2012 R2 Standard 6.2.9200 with IIS 8.5.9600. 服务器: Windows Server 2012 R2 Standard 6.2.9200和IIS 8.5.9600。


The story 故事

We've created a blank MVC Web application using the default project templates provided in Visual Studio 2017. 我们使用Visual Studio 2017中提供的默认项目模板创建了一个空白的MVC Web应用程序。

The app is deployed following the official specification: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/ . 该应用程序是按照官方规范进行部署的: https : //docs.microsoft.com/zh-cn/aspnet/core/host-and-deploy/iis/

The confusion arises mainly from these two points : 混淆主要来自以下两点

  1. Running the app through command-line on Kestrel works. 在Kestrel上通过命令行运行应用程序即可。
  2. Running a different app but targeting .NET Core 2.0 and publishing as framework-dependant works flawlessly on IIS. 运行不同的应用程序但以.NET Core 2.0为目标并以依赖于框架的方式发布在IIS上可以完美地工作。 But between these two apps: the codebase is the same, the IIS website and application pool is the same and we even emptied out the app directory and used the same one. 但是在这两个应用程序之间:代码库是相同的,IIS网站和应用程序池是相同的,我们甚至清空了应用程序目录并使用了相同的目录。

Due to these points the only difference seems to be the net461 app's executable file. 由于这些原因,唯一的区别似乎是net461应用程序的可执行文件。

We do not have full control over the Windows Server where we're trying to deploy but we do have administrator accounts. 我们没有完全控制要在其中部署Windows Server的权限,但是我们有管理员帐户。 The current assumption is that the issue lies within permissions - maybe AD group policies, antivirus blocking the file but we're still awaiting response from the client's sysadmins. 当前的假设是问题出在权限之内-可能是AD组策略,防病毒软件阻止了该文件,但我们仍在等待客户端sysadmins的响应。 Meanwhile we haven't been able to replicate the error code ' 0x80004005: 1 ' while trying to setup these restrictions on our development machines. 同时,在尝试在我们的开发计算机上设置这些限制时,我们无法复制错误代码“ 0x80004005: 1 ”。

Here's an incomplete list of ideas and points about the issue we've tried while problem solving: 这是关于我们在解决问题时尝试过的问题的观点和要点的不完整列表:

  • The initial app (targeting net461) works flawlessly on IIS when deployed to other servers (Windows 10 Enterprise, Windows Server 2012 R2 Datacenter). 初始应用程序(定位为net461)在IIS上部署到其他服务器(Windows 10企业版,Windows Server 2012 R2数据中心)时可完美运行。
  • Reinstalling different versions of ASP.NET Core/.NET Core: Runtime & Hosting Bundle. 重新安装不同版本的ASP.NET Core / .NET Core:运行时和主机捆绑包。
  • Setting NTFS permissions to the dotnet folder. 将NTFS权限设置为dotnet文件夹。
  • Changing IIS application pool identity to an administrator account. 将IIS应用程序池标识更改为管理员帐户。
  • Restarting the server. 重新启动服务器。
  • Going over local group and security policies. 遍历本地组和安全策略。
  • Going over the antivirus settings and logs. 查看防病毒设置和日志。
  • Trying to deploy on a brand new server (same OS, same bloat). 尝试在全新服务器上部署(相同的操作系统,相同的配置)。

All ideas/comments are greatly appreciated. 所有想法/评论都将不胜感激。 The more obscure the better. 越模糊越好。

EDIT: 编辑:

Since this got flagged as a possible duplicate of ASP.NET Core 0x80004005 I need to specify why that is not a duplicate. 由于已将其标记为ASP.NET Core 0x80004005的可能重复项,因此我需要指定为什么它不是重复项。

  • That referenced project is an older version of ASP.NET Core (last use of project.json was in 2016) 引用的项目是ASP.NET Core的旧版本(project.json的最后使用是在2016年)
  • That referenced project targets .NET Core and not .NET 4.6.1. 所引用的项目针对的是.NET Core,而不是.NET 4.6.1。 It is mentioned here as well that targeting .NET Core works on IIS in regard to this issue. 这里还提到,针对此问题,将.NET Core作为目标可在IIS上运行。
  • Selected answer points out that they fixed it by: 选定的答案指出,他们通过以下方式解决了问题:

    Turns out that this was result of needing to install some windows updates and this problem: 原来,这是需要安装一些Windows更新和以下问题的结果:

    api-ms-win-crt-runtime-l1-1-0.dll is missing when opening Microsoft Office file 打开Microsoft Office文件时缺少api-ms-win-crt-runtime-l1-1-0.dll

    Rather than install the version discussed in the above issue I whet into Programs and Features and ran a repair on Microsoft Visual C++ 2015 Redistributable. 我没有安装上一期中讨论的版本,而是进入“程序和功能”并在Microsoft Visual C ++ 2015 Redistributable上进行了修复。

    but the installation of Microsoft Visual C++ 2015 Redistributable is one of the steps in the official setup guide and it is mentioned here as well that the official guide has been followed during the setup process. 但是Microsoft Visual C ++ 2015 Redistributable的安装是官方安装指南中的步骤之一,并且在此还提到在安装过程中遵循了官方指南。

  • We have gone over that post and tried to repair and reinstall the Microsoft Visual C++ 2015 Redistributable runtime components and this did not fix the issue. 我们已经查看了该帖子,并尝试修复并重新安装Microsoft Visual C ++ 2015 Redistributable运行时组件,但这不能解决问题。

If anyone stumbles upon this post in the future: 如果将来有人偶然发现此帖子:

The problem was indeed in the server's antivirus. 问题确实出在服务器的防病毒中。 It wasn't directly blocking the app's executable but its call to a class library in the system folder. 它并没有直接阻止应用程序的可执行文件,而是调用了系统文件夹中的类库。 This termination did not raise any of the usual alarms. 此终止未引发任何常规警报。

The application "C:\inetpub\apps\AppFolder\App.exe" attempted to load the library "bcrypt.dll" by calling the function "LoadLibraryExW". The operation was blocked and the application terminated.

After switching the MVC blank app to a completely blank Hello-World app it ran successfully. 将MVC空白应用程序切换为完全空白的Hello-World应用程序后,它成功运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM