90

error

I want to publish a sample .net core web application on my pc's IIS manager but I failed. I am using Microsoft guidance but it doesn't work for me, if you have reasonable experience to fix this problem I would be grateful to see your suggestions.

Lex Li
  • 60,503
  • 9
  • 116
  • 147
Ali Jahanbin
  • 923
  • 2
  • 7
  • 6

12 Answers12

110

I was missing the AspNetCoreModule from IIS->Modules. After I installed that I no longer had the 500.19 error.

To find out more this blog was great: https://weblog.west-wind.com/posts/2016/Jun/06/Publishing-and-Running-ASPNET-Core-Applications-with-IIS

Here is the page from Microsoft to find the download: https://learn.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x

Enkode
  • 4,515
  • 4
  • 35
  • 50
  • 1
    In your case "Config Error" field would be a different message. – Lex Li Apr 20 '18 at 12:09
  • 1
    Thanks for the blog. Really helped me understand how .net core apps were hosted. – Ash Oct 08 '18 at 12:48
  • This worked perfect, I faced exactly same issue. Windows Server Hosting installer for .Net Core was missing on Windows server. – ramya Nov 07 '19 at 11:34
  • 1
    Currently latest version that I installed and worked for me is: dotnet-hosting-2.2.7-win.exe (Go to the bottom last section) [https://github.com/dotnet/core/blob/master/release-notes/2.2/2.2.7/2.2.7-download.md](https://github.com/dotnet/core/blob/master/release-notes/2.2/2.2.7/2.2.7-download.md) – ramya Nov 07 '19 at 11:38
48

You have to install the "Hosting Bundle Installer". Without this, IIS doesn't understand routing and cannot host your application.

Go to microsoft site "https://www.microsoft.com/net/download/dotnet-core/runtime-2.1.0-rc1" and install "Hosting Bundle Installer":

enter image description here

Before installing this you have to install the right version of runtime: https://www.microsoft.com/net/download/dotnet-core/runtime-2.1.0-rc1 Than install the right version of "Hosting Bundle Installer".

"Hosting Bundle Installer" is: .NET Core Windows Server Hosting bundle installs the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. The module creates a reverse proxy between IIS and the Kestrel server on Windows platforms.

Sadjad Khazaie
  • 2,102
  • 22
  • 22
  • 1
    I'm not entirely sure why this was downvoted, Sadjad. Your solution pointed me to the correct spot almost instantly. I had downloaded and initiated the x64 Installer instead of using the Hosting Bundle Installer. As soon as I did so, everything worked flawlessly. Thank you! – Trevor Yokum Jun 15 '18 at 20:23
  • I am happy to read this. The reason that it was down-voted, was because I created the same answer to similar question somewhere else.I didn't like it and I don't think its fair. Thank you and success. – Sadjad Khazaie Jun 17 '18 at 16:58
  • 1
    A few years later but still helps me better that the actual selected answer!! Great – Ray Jan 29 '20 at 15:18
23

The identity under which your web application runs in IIS doesn't have full access to the folder in which the web.config file is found. Which version of IIS are you using? Assuming 7, you can view/change the identity through the 'Advanced Settings' of the application pool that hosts your application. Folder permissions can be granted via Windows Explorer in the usual way.

Andy Lamb
  • 2,151
  • 20
  • 22
9

Sure, you have to follow this tutorial to deploy to IIS:

https://learn.microsoft.com/en-us/aspnet/core/publishing/iis

I would suggest you to do this:

  1. Publish your web application to desktop.

  2. Copy the folder to the server.

  3. Open cmd and run cd

  1. In cmd run dotnet webapplication.dll

  2. You should see that application is run and waiting for responses on localhost:port.

  3. Open browser and navigate there. It should work.

Otherwise, you will be able to see all the errors in the cmd window. OR Go to microsoft site "https://www.microsoft.com/net/download/dotnet-core/runtime-2.1.0-rc1" and install "Hosting Bundle Installer":

tayfun Kılıç
  • 2,042
  • 1
  • 14
  • 11
7

In my case I was getting the same error.

It was nothing to do with the permissions.

I had to install the followings 1- Microsoft .NET Core Runtime 2- Microsoft ASP.NET Core Runtime 3- Microsoft ASP.NET Core Hosting Bundle

from the below location. (Please chose the relevant version) https://dotnet.microsoft.com/download/archives

Then I had to execute the following commands as well. net stop was /y net start w3svc

You can either restart the machine.

That fixed for me.

Zeshan Qureshi
  • 135
  • 1
  • 4
  • After spending 2+ hours wrapping my head around file/folder permissions, web.config file contents, .Net application pools, user identities and such, I decided to stop "w3svc" service, tear down (read: uninstall) everything .Net related, install latest ASP .Net Core Hosting Bundle, and restart the IIS (``net start w3svc``). And it worked! Weird, but thanks. – leonidos79 May 06 '20 at 11:49
5

Write dotnet --info in your command prompt to see your SDK versions. (after words .NET SDKs installed:)

Find your equal Hosting Bundle version and install it.

For example : SDK 3.1.408 needs Hosting Bundle 3.1.14.

https://karthiktechblog.com/aspnetcore/how-to-solve-http-error-500-19-internal-server-error-in-windows-server-iis-for-dotnet-core-application

M Komaei
  • 7,006
  • 2
  • 28
  • 34
4

Try to edit/open any configuration for the site.

If you can't access the configuration options for the site under IIS Manager, check commenting the tag < aspNetCore >, if problem solve, uncomment it and install.

ASP.NET Core Hosting Bundle.

ASP.NET Core 3.1 Runtime (v3.1.3) - Windows Hosting Bundle Installer.

Oscar Perez
  • 111
  • 1
  • 5
  • This is what worked for me! Thank you! I haven't seen anyone else mentioning the fact that accessing any configuration doesn't work so this was spot on! – Freece Oct 14 '20 at 07:04
4

We've observed this problem on our server even though Hosting Bundle was already installed. The problem was, the hosting bundle was installed BEFORE IIS feature was enabled. The fix was to Repair hosting bundle install by running the installer again.

Eternal21
  • 4,190
  • 2
  • 48
  • 63
2

I also had this problem and the problem was solved by installing the Hosting Bundle Installer. You can install from url: https://dotnet.microsoft.com/download/dotnet

RainyTears
  • 171
  • 4
1

Very good, in my case a module called "urlrewrite" was missing.

You install it with the "Microsoft Web Platform Installer" application.

Fernando Arce
  • 332
  • 2
  • 14
0

We had a slightly different issue at my work. We had a publish profile in Visual Studio set to delete all files upon publishing, and this was a problem for us because we manually gave our IIS service account filesystem permissions to that one, explicit folder beforehand.

So with that publish flag enabled, it zapped the folder and its permissions alongside it and caused a filesystem permissions issue after.

We just disabled this flag in the Visual Studio publish profile and it was fine after that.

enter image description here

Daniel Miradakis
  • 93
  • 1
  • 2
  • 5
0

In my case issue with the permission in inetpub folder. When I moved source files out of inetpub folder and placed in a different folder it worked.

nadun
  • 21
  • 7