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

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

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

Website Hosting

How to enable URL rewriting using the Turnkey Linux LAMP stack

by johna | December 27, 2023
An extra part covering URL rewriting for my guide to setting up a website and database using the Turnkey Linux LAMP stack.

Web Development

How to set up a debugging using the Turnkey Linux LAMP stack and VS Code

by johna | December 19, 2023
The second part in my guide to setting up a website and database using the Turnkey Linux LAMP stack.

Website Hosting Web Development

How to set up a website and database using the Turnkey Linux LAMP stack

by johna | November 18, 2023
If you need to host your own website for the purposes of web development, Turnkey Linux LAMP Stack is an easy to install all-in-one solution that you can set up on a spare computer or a VM (Virtual Machine).

Comments

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

Leave a Comment

About

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

I recommend ASPnix for web hosting and Crazy Domains for domain registration.

Subscribe

Get the latest posts delivered to your inbox.