404s with ASP.MVC on IIS 7.5

I was getting page not found errors yesterday when trying to deploy an ASP.Net MVC website which of course worked fine in Visual Studio to IIS 7.5. I tried a couple of things to resolve based on what I had read online including:

  • ensuring appPool was set to pipeline mode of Integrated and targeted towards v4.0
  • ensuring
    <system.webServer>
    <modules  runAllManagedModulesForAllRequests=”true“>
    <validation validateIntegratedModeConfiguration=”false”/>
    </system.webServer>
  • re-registering the .Net framework 4.0 with the aspnet_regiis tool to get all the latest HTTP handlers.

I believe the first two might be required but it was running the aspnet_regiis tool which done the trick for me. As highlighted below, you need to run this as an administrator. Right click on cmd.exe and select ‘Run as administrator’ and then navigate to the .Net framework 4.0 install directory to run the tool.

reregisterNetFramework

 

After you’ve registered 4.0 with IIS you should now see much more HTTP handlers in your IIS configuration manager. The most important one I believe (but I didn’t disable to confirm) in this instance is ExtensionlessUrlHandler-Integrated-4.0

httphanders

404’s disappeared for me after that. Of course during my research there seemed to be a lot of things which could have caused this problem but running aspnet_regiis is what worked for me. I think it might have been because I installed IIS after installing 4.0, but I’m not sure.

Leave a Reply

Your email address will not be published. Required fields are marked *