16

I deployed an ASP.NET MVC 4 project to my testing server, but it does not seem to run.

Attempting to access the project URL on IIS 7 after deployment attempts to list the directory contents. Checking the folders reveals that all assemblies have been deployed. Enabling directory browsing actually lists the files in the directory and can serve static files.

It's as if my .NET 4.0 application pool is not routing any requests to the controllers.

What could be causing this?

Petrus Theron
  • 27,855
  • 36
  • 153
  • 287

2 Answers2

41

Solution

Found the solution out of sheer luck, which is setting runAllManagedModulesForAllRequests to true in web.config:

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    ...
</system.webServer>
Petrus Theron
  • 27,855
  • 36
  • 153
  • 287
  • 4
    i have wasted a whole day due to this thing... why not it is part of mvc template for deployment. – Usman Masood Jan 08 '13 at 15:16
  • This works!!! Some other people said that this wasn't neccesary, but in my case it was – eKek0 Jul 19 '13 at 13:51
  • Sheesh. I spent hours trying to get my MVC project to run. Thank you. For my own sanity, I would like to understand why that web.config change was necessary but the referenced 'sheer luck' solution is no longer there. Anyone know what it was and have another link to it. – nitewulf50 Dec 09 '13 at 21:55
  • @nitewulf50 fixed link. – Petrus Theron Dec 10 '13 at 08:56
  • 1
    Thank-you for posting this. I scoured the net trying to resolve this problem; your simple line + a restart and presto, MVC asp.net site runs. – NoCake Sep 26 '20 at 17:46
1

I had this exact problem the other day when starting a new project on a new machine. Then I found this question and all of my wildest dreams came true.

Community
  • 1
  • 1
Nick Larsen
  • 18,631
  • 6
  • 67
  • 96