HTTP Error 500.19 - Internal Server Error

I was just asked how to troubleshoot an HTTP Error 500.19 - Internal Server Error when trying to launch an ASP.NET Core website on IIS. I have seen this error too many times for both ASP.NET and ASP.NET Core so decided to write a blog post about at least one, obvious, fix.

HTTP Error 500.19 - Internal Server Error

The problem happens when deploying the ASP.NET or ASP.NET Core website to IIS and getting the following error message in the browser:

HTTP Error 500.19 - Internal Server Error

The issue here is that the error message doesn't say anything about what's wrong. The Config File and Config Source sections indicate that this has to do with the web.config file. While it may indeed be a web.config error in your case, there's one thing to check first: Verify that the IIS can serve ASP.NET (Core) websites. The rest of this post is split up into two sections, one for ASP.NET and the other for ASP.NET Core.

ASP.NET

If what you are trying to host is an ASP.NET website, you will need to enable ASP.NET through Windows. To check if this is already done, launch the Internet Information Services (IIS) Manager. If it's not installed, hit Start and search for 'Turn Windows features on or off'. Launch the Control Panel and make sure that IIS Management Console is enabled:

Turn IIS Management Console on

When launching the Manager, go to the server node and inspect this area:

IIS without ASP.NET installed

In this example, ASP.NET is nowhere to be found within that red square, meaning that it is not enabled. Go back to Windows Features and make sure to enabled both .NET Extensibility 4.8 and ASP.NET 4.8:

Turn ASP.NET on

Once enabled, relaunch Internet Information Services (IIS) Manager and verify that a new ASP.NET section is shown when selecting the server:

IIS with ASP.NET installed

Your IIS is now ready to serve ASP.NET applications. When googling this problem, you may find some old posts, telling you to run the aspnet_regiis command-line tool. This was valid in the old days, but with modern versions of Windows and IIS, you will need to follow the approach specified above.

ASP.NET Core

For ASP.NET Core applications, enabling ASP.NET through Windows Features will not allow for IIS to host ASP.NET Core apps. To fix this, make sure to install the .NET Core Hosting Bundle from here. There are versions available for all new major versions of .NET. Make sure to pick the most recent stable version. Also, install IIS through Windows Features before installing the Hosting Bundle.

Unlike the support for ASP.NET, the Hosting Bundle for ASP.NET Core doesn't show up as a new section within the IIS Manager. You can verify that the bundle is successfully installed by double-clicking Modules:

Modules in IIS Manager

And look for 'AspNetCoreModule' in the list of installed modules:

AspNetCoreModule installed in IIS

elmah.io: Error logging and Uptime Monitoring for your web apps

This blog post is brought to you by elmah.io. elmah.io is error logging, uptime monitoring, deployment tracking, and service heartbeats for your .NET and JavaScript applications. Stop relying on your users to notify you when something is wrong or dig through hundreds of megabytes of log files spread across servers. With elmah.io, we store all of your log messages, notify you through popular channels like email, Slack, and Microsoft Teams, and help you fix errors fast.

See how we can help you monitor your website for crashes Monitor your website