I upgraded from ASP.NET MVC 4 to MVC 5, and my site stopped working. Accessing it from the internet gave a 403 - Forbidden: Access is Denied. Accessing it from the VM with the site gave the message Error 403.14 Forbidden The Web server is configured to not list the contents of this directory. In addition, the event log said there was an error loading System.Web.Mvc v 5. A lot of the answers for stuff like this said you had to re-register ASP.NET, but that is not allowed for IIS 8.
I'm running Windows Server 2012 R2 on Azure and ASP.NET 4.5.
I solved this problem by uninstalling all of the ASP.NET items in Programs and Features, then reinstalling ASP.NET like this with Server Manager using Add Roles and Features: picked Role-Based or Feature-Based installation, picked my server, and then for Select Server Role picked Web Server (IIS)/Web Server/Application Development, then clicked ASP.NET 4.5, confirmed installation of a prerequisite, and then reinstalled ASP.NET 4.5.
My previous searches had lead me to believe that the problem actually stems from a registration problem with ASP.NET. With earlier versions of ASP.NET, there is actually a utility that you can run to register ASP.NET without reinstalling, but that doesn't seem to be available any longer.
Before going to any other solution check that if you have .Net Razor SDK(MVC 5) is installed on your machine or not. Download it from HERE. Although VS has already installed it for its own environment but it's still needed to be installed separately on machine so that .NET start recognizing MVC structure.
© 2022 - 2024 — McMap. All rights reserved.