Reputation: 11391
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.
Upvotes: 1
Views: 481
Reputation: 11391
Turns out that this was a bug in the mono routing implementation.
I filled a bug report here: https://bugzilla.novell.com/show_bug.cgi?id=500739. And it has now been fixed, although I haven't tried it yet.
Upvotes: 1
Reputation: 1038790
It seems like a bug in the ASP.NET MVC templates for MonoDevelop as suggested in the comments section of this post.
Upvotes: 1