简体   繁体   中英

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.

Browser: HTTP Error 502.5 - Process Failure

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 '.

ASP.NET Core Module Log: Log file is created but is empty.


The setup

App: ASP.NET Core 2.0 targeting .NET Framework 4.6.1.

Server: Windows Server 2012 R2 Standard 6.2.9200 with IIS 8.5.9600.


The story

We've created a blank MVC Web application using the default project templates provided in Visual Studio 2017.

The app is deployed following the official specification: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/ .

The confusion arises mainly from these two points :

  1. Running the app through command-line on Kestrel works.
  2. Running a different app but targeting .NET Core 2.0 and publishing as framework-dependant works flawlessly on 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.

Due to these points the only difference seems to be the net461 app's executable file.

We do not have full control over the Windows Server where we're trying to deploy but we do have administrator accounts. 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. Meanwhile we haven't been able to replicate the error code ' 0x80004005: 1 ' while trying to setup these restrictions on our development machines.

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).
  • Reinstalling different versions of ASP.NET Core/.NET Core: Runtime & Hosting Bundle.
  • Setting NTFS permissions to the dotnet folder.
  • Changing IIS application pool identity to an administrator account.
  • 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.

  • That referenced project is an older version of ASP.NET Core (last use of project.json was in 2016)
  • That referenced project targets .NET Core and not .NET 4.6.1. It is mentioned here as well that targeting .NET Core works on IIS in regard to this issue.
  • 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:

    api-ms-win-crt-runtime-l1-1-0.dll is missing when opening Microsoft Office file

    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.

    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.

  • 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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