Can’t get MVC3 running on IIS 7.5

asp.net-mvciis-7

I have a development laptop with Visual Studio 2010 and MVC2 and MVC3 installed. I deployed an MVC3 application to a local inetpub location and set it up to run under IIS 7.5. At first I couldn't get URL rewriting to work at all, my symptoms were identical to this question. Following the advice posted for that other question, I ran aspnet_regiis with both the -i and -r switches. This still didn't change the site behavior, so i deleted and re-created the site. I'm now getting the following error:

Failed to map the path '/'

Here's the stack trace:

[InvalidOperationException: Failed to
map the path '/'.]
System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags
hostingFlags, PolicyLevel policyLevel,
Exception appDomainCreationException)
+378

[HttpException (0x80004005): Failed to
map the path '/'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext
context) +8972180
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext
context) +97
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +256

Best Answer

After many dead ends, I found the root cause of the problem: it turns out that MVC URL rewriting has dependencies on other IIS modules. I enabled static content compression and suddenly all of my MVC sites started working (in the course of researching this I created several MVC2 and MVC3 sites and all had the same problem).

I found the answer in this knowledgebase article.