R – Error when accessing anything but default route

asp.net-mvcmonorouting

I am having trouble getting routing to work on mono. The default route works fine but nothing else does.

These are the routes I have setup:

        routes.MapRoute(
            "HelloRoute",
            "Hello/{name}",
            new { controller = "Home", action = "Hello" }
        );

        routes.MapRoute(
            "Default",
            "{controller}/{action}/{id}",
            new { controller = "Home", action = "Index", id = "" }
        );

and on my HomeController I have the corresponding action:

    public ActionResult Index ()
    {
        ViewData["Message"] = "Welcome to ASP.NET MVC on Mono!";
        return View ();
    }

        public ActionResult Hello(string name)
    {
        ViewData["Message"] = "hello "+name;
        return View ();
    }

now if I navigate to http://localhost/ I get the message Welcome to…
but if I go to http://localhost/Hello/World I get an error:

value name controller does not match any of the values.

Description: HTTP 500. Error processing request.

Stack Trace:

System.InvalidOperationException: value name controller does not match any of the values.
at System.Web.Routing.RouteData.GetRequiredString (System.String valueName) [0x00000]
at System.Web.Mvc.MvcHandler.ProcessRequest (System.Web.HttpContextBase httpContext) [0x00000]
at System.Web.Mvc.MvcHandler.ProcessRequest (System.Web.HttpContext httpContext) [0x00000]
at System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest (System.Web.HttpContext httpContext) [0x00000]
at System.Web.HttpApplication+c__Iterator2.MoveNext () [0x00000]
at System.Web.HttpApplication.Tick () [0x00000]

am I doing something obviously wrong?

Apart from the aditional route, action and view this is a standard asp.net mvc project created in Monodevelop.

Best Answer

It seems like a bug in the ASP.NET MVC templates for MonoDevelop as suggested in the comments section of this post.