IIS configuration - ASP.NET MVC returns default document on all requests

asp.net, asp.net-mvc, asp.net-mvc-4, iis

Solution

I have finally got it by reading Elian Ebbings anwser in How to host MVC application in IIS 7.0?

Turns out all that I needed to do was change the web config so that the modules section has the runAllManagedModulesForAllRequests set to true. e.g.

So my web config changed

From:

<system.webServer>
    <modules>
      <remove name="FormsAuthenticationModule" />
    </modules>
</system.webServer>

To:

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="FormsAuthenticationModule" />
    </modules>
</system.webServer>

Problem

Ok so I have an MVC Web application built in VS 2013. I have been able to host this application successfully through IIS on my local machine with no problems. However I now need to host on a remote machine. I have followed the same steps as I did on my local machine but I keep getting errors. When I try to browse the web application i get an error HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory. However I have created a default document as the details of this error tell me to and now every time I try to access the application (localhost/MyWebApp) it will just go to that default.html. However when I specify that I want to go to a specific controller (e.g. localhost/MyWebApp/Home) I get 404 error (HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.) The machine I am currently trying to host on does not have visual studio installed for various reasons, but I have installed ASP.NET MVC 3 and .NET 4.5 Framework on it. The Default website on the remote machines IIS also already has a classic.net app running successfully. My thoughts are that: 1 - I am missing some pre-requisite needed to host an asp.net mvc application (possibly something that is installed with visual studio) Or 2 - Something in IIS is incorrectly configured. Any advice is welcome as a few hours of goggling has brought up no answers and I have exhausted my knowledge of IIS Edit Have figured it out and marked it as an answer below.

Original source