500 Internal Server Error after migrating from IIS 7.5 to IIS 10

John Avis by | November 4, 2019 | Computers & Internet Web Development Website Hosting

As support ends for Microsoft Windows Server 2008 I have recently gone through migrating some websites to a new server running Windows Server 2016 and IIS 10 but some of the websites did not work.
iis10-hsts.jpg

As support ends for Microsoft Windows Server 2008 in January 2020, I have recently gone through migrating some websites to a new server running Windows Server 2016 and IIS 10.

The websites were migrated with the Web Deploy Tool.

Some of the websites did not work, and simply brought up a 500 Internal Server Error, bypassing custom error pages. This is always a sign that the cause of the error might be in the web.config file.

After a little experimenting with commenting out certain sections of the web.config file, I found two sections that had compatibility issues between IIS 7.5 and IIS 10.

The first was the "staticContent" section. I had used this to allow IIS to server .woff and .svg files. This is no longer needed for those types of files in IIS 10 so the section could be removed.

The other problem was where the IIS URL rewrite module had been used to automatically redirect from HTTP to HTTPs.

This module is not installed in IIS 10 by default.

You could download the URL Rewrite extension (https://www.iis.net/downloads/microsoft/url-rewrite) but if you are only using this to redirect from HTTP to HTTPS then IIS 10 has an easier way of doing this:

• Open the IIS console and select the website
• On the "Actions" pane you will see the "HSTS" option below the "Configure" section
• Enable HSTS and "Redirect Http to Https"

(Source: https://www.hametbenoit.info/2018/10/22/windows-server-2019-you-can-now-easily-redirect-http-request-to-https/)

There may be other causes of these problems too but they should be reasonably easy to identify by commenting out sections of the web.config file one at a time and testing, and a little research with your favourite search engine.

Related Posts

Jquery/Javascript Web Development

tagInput: A simple jQuery plugin for tag entry using Bootstrap 4

by John Avis | October 15, 2019

For a website project I needed a way to enter multiple tags. I just wanted something simple that I could easily modify to suit my own needs, so I wrote my own.


Computers & Internet

How to send an Instagram DM on a Windows desktop PC

by John Avis | September 4, 2019

Am I right? Is it not possible to send an Instagram DM (Direct Message) on a desktop? Here's how to do it though.


ASP.NET Web Forms Web Development

ASP.NET bug with RadioButton GroupName in Repeater

by John Avis | September 1, 2019

I rediscovered a bug in ASP.NET that affects RadioButtons inside repeaters. Here is my solution to the problem.

Comments

There are no comments yet. Be the first to leave a comment!

Leave a Comment

Tags

About me

...random postings about web development and programming, Internet, computers, electronics and automotive topics.

Subscribe

Get the latest posts delivered to your inbox.