I am working with a brand-new Windows Server 2016 virtual machine and I deployed an ASP.NET MVC Web API application on it using Web Deploy from Visual Studio 2017. However, I found that when I browsed to the application locally, I received a page with the following error:
HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.
After doing some research online I found that this is a common issue and that many solutions have been given. For example, see the following:
MVC4 HTTP Error 403.14 - Forbidden
HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents
ASP MVC in IIS 7 results in: HTTP Error 403.14 - Forbidden
HTTP Error 403.14 - Forbidden - MVC4 .net 4.5 bundles
HTTP Error 403.14 - Forbidden. Asp.NET MVC
HTTP Error 403.14 - Forbidden IIS Error for ASP.Net MVC 4 Application
However, none of the solutions I tried resolved this problem on my Windows Server 2016 instance.
Here's the solution that worked for me:
Many people suggested running the following command to register ASP.NET on the machine:
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir
It turns out that in Windows Server 2016, you need to go to the Add Roles and Features Wizard to do this (search for "turn windows features on or off" in the Windows search). In the wizard, click Next until you get to the Server Roles page. Scroll down and open the following node:
Web Server (IIS) > Web Server > Application Development
Put a checkmark next to "ASP.NET 4.6" and click Next, and follow the prompts to install it.
After installing ASP.NET 4.6 I found that the 403.14 issue was resolved.