views:

186

answers:

3

I published my VS2008 ASP.NET MVC 1.0 project to a local folder, then FTPed it to a virtual directory on my host (GoDaddy). I attempted to run and it complained that System.Web.Mvc.dll is missing, so I copied that.

After that I get a 404. Now I know that it gets to my HomeController.Index method, because it does a RedirectToAction. That next action (which is in the same controller) is what causes the problem.

I have a feeling that the routing is not working correctly.

I watched the app with Fiddler:

  1. I goto http://www.mydomain.com/myApp
  2. Results in a 301 (permanent redirect) to http://www.mydomain.com/myApp
  3. Then I get a 302 (redirect to /myApp/Home/Details/2). This is correct because my Index method on the HomeController does a RedirectAction to the Details method with a parameter of 2.
  4. Then the browser hits http://www.mydomain.com/myApp/Home/Details/2. At this point I get a 404 Not found.

So it seems like /Home/Details/2 does not map onto my controller despite the following code being global.asax:

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

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

}

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

So what am I missing?

+2  A: 

You only need your MVC dll deployed. Routing comes with SP1. I would suggest:

  • Create a test / status controller returning basic information
  • Use Firebug or Fiddler like tool to see what's happening on HTTP
  • Try to find any issues with your configurations:
    • Make sure to have Routing and MVC Http modules / handlers in your web.config
    • Make sure your extensions are correct especially on IIS 6 (eg. if you are usign .mvc it should be in your routes as well as IIS configuration and web.config)
    • IIS 6 configuration can be trickey
    • AFAIK (sorry don't know enought about this but) IIS 7 configuration should be in your web.config too.

I have been in similar situations pulling my hair out, unfortunately my experience has been (mainly on IIS 6 though) that I had to double check and check all these points over and over again and trial and error with configurations to get it working.

Maxwell Troy Milton King
I did a couple of things you suggested (see the updated question), did not work. I hear you about IIS6, but this is GoDaddy - I have no control over it.
AngryHacker
+1  A: 

Make sure the server has ASP.NET MVC 1.0 RTM installed - since it has all the dlls (routing, mvc, etc etc) necessary to run your MVC site.

Johannes Setiabudi
+1  A: 

Well, the answer was staring me in the face the whole time:

alt text

The link explains what to do if your host is either IIS6 (which goDaddy is) or IIS7 classic mode.

AngryHacker