views:

2777

answers:

3

Hi

I need a little help. I'm trying to host an MVC 2 application on IIS6. On my dev machine (XP) it runs perfectly in Cassini or as web site in IIS.

First i tried to reference the .mvc extension to aspnet_isapi but when that didn't work i went with the aspx extension instead.

Any ideas? I've probably missed something obvious.

public class MvcApplication : HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            AreaRegistration.RegisterAllAreas();

            routes.MapRoute(
                "Default", // Route name
                "{controller}.aspx/{action}/{id}", // URL with parameters
                new {controller = "Home", action = "Index", id = ""} // Parameter defaults
                );
            routes.MapRoute(
                "Root",
                "",
                new {controller = "Home", action = "Index", id = ""}
                );
        }

        protected void Application_Start()
        {
            RegisterRoutes(RouteTable.Routes);
        }
    }

alt text

EDIT:

Had some bad references that i cleaned out and is now stuck with this on my master page: alt text

A: 

Does your .aspx mapping in IIS (or your failed .mvc mapping) have the "check that file exists" option ticked?

That's the most obvious first place it can fail. Also, when the .mvc mapping failed, was it the same error or different (realise that this latter sentence may have been better as a comment...)

Damien_The_Unbeliever
Neither of the mappings have that checked unfortunately.
magnus
+1  A: 

I think you should try this: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx

brainnovative
A: 

Hi Magnus,

I am also trying to run an ASP.NET MVC 2 application on IIS 6. Could you elaborate some more on the installation script? Where is it located at? What exactly did you do to get your MVC 2 app to work on IIS 6?

hungster
That script is part of our custom built tool for deploying on multiple servers and different stages. The thing that got it to work on IIS6 for me was setting up a wildcard mapping. This thread have the steps to perform http://stackoverflow.com/questions/275920/asp-net-mvc-on-iis-6-wildcard-mapping-the-incoming-request-does-not-match-any
magnus
Thanks for your link. My MVC 2 web app is working on IIS 6 now.
hungster