ASP.NET MVC 403/404 errors on AWS Windows Server 2012

I recently tried to deploy¬†a sample ASP.NET MVC project created in VS 2015 to my AWS Windows Server 2012, following the excellent tutorial by Martin Buberl. The deploy process itself is smooth, but after the deployment, the web application won’t work.

The errors are not very helpful: On visiting the home directory, it shows “403 – Forbidden: Access is denied.” error. On visiting a sub directory directly, it shows “404 – File or directory not found.” error. A quick¬†search will show a trillion different solutions (and yet I am adding another one here!), because obviously may different causes can lead to these same errors.

One good thing is that when I put a default IIS start page in the site directory, it shows up correctly. So IIS is working, at least, which greatly narrows down the possible leads to check.

After even more readings and tries and errors, it turns out the AWS Windows Server 2012 image don’t have ASP.NET 4.5 installed by default. Everything works fine by simply adding .NET Extensibility 4.5 and ASP.NET 4.5 via Add Roles and Features.

9-14-2015 10-37-10 AM

You may also want to double check the IIS DefaultAppPool is set to use .NET Framework v4.0. But in my case this seems to be set automatically.

9-14-2015 11-28-40 AM