ControllerNotFoundException with RoutingModuleEx on Mono+Linux

7 views
Skip to first unread message

Ricardo Lopes

unread,
Mar 19, 2009, 6:29:31 PM3/19/09
to castle-pro...@googlegroups.com
Hi,

I am doing some tests on mono+linux and everything works fine for my
application (using MONO_IOMAP) except for the new routing module.

In the routing rules i define the area as empty but the monorail
handler seems to be ignoring it.

In my routes i have this:

rules.Add(new PatternRoute("profilelist",
"/profile/list/").DefaultForArea().IsEmpty.DefaultForController().Is("profile").DefaultForAction().Is("list"));


When I try the url for that route i get a ControllerNotFoundException.

http://127.0.0.1/profile/list

Controller not found. Area: 'profile' Controller Name: 'profile'

Description: HTTP 500. Error processing request.

Stack Trace:

Castle.MonoRail.Framework.ControllerNotFoundException: Controller not
found. Area: 'profile' Controller Name: 'profile'
at Castle.MonoRail.Framework.MonoRailHttpHandlerFactory+NotFoundHandler.ProcessRequest
(System.Web.HttpContext context) [0x00000]
at System.Web.HttpApplication+<Pipeline>c__Iterator2.MoveNext () [0x00000]
at System.Web.HttpApplication.Tick () [0x00000]

The same code works fine on windows + cassini.

Any ideas?
Thanks.

Ken Egozi

unread,
Mar 20, 2009, 3:36:11 AM3/20/09
to castle-pro...@googlegroups.com

Ricardo Lopes

unread,
Mar 20, 2009, 5:01:13 PM3/20/09
to castle-pro...@googlegroups.com
Hi,

In the case of that route I got an error with or without slash,
however the message changes a little bit.

URL (with slash): http://127.0.0.1/profile/list/
Castle.MonoRail.Framework.ControllerNotFoundException: Controller not
found. Area: 'profile/list' Controller Name: 'profile'

URL (without slash): http://127.0.0.1/profile/list
Castle.MonoRail.Framework.ControllerNotFoundException: Controller not
found. Area: 'profile' Controller Name: 'profile'

the route for that path is:

rules.Add(new PatternRoute("profilelist",
"/profile/list/").DefaultForArea().IsEmpty.
DefaultForController().Is("profile").DefaultForAction().Is("list"));


I have another page that behaves ok without slash and throws the
exception with the slash:

URL: http://127.0.0.1/createaccount
Result: Everything OK

URL : http://127.0.0.1/createaccount/
Castle.MonoRail.Framework.ControllerNotFoundException: Controller not
found. Area: 'createaccount' Controller Name: 'createaccount'


If I use the old fashion url's everything works fine.

I also notice that the UrlHelper.For() is producing bad url's (site
root instead of pretended url) for the routes that accept parameters,
the others that doesn't need parameters are fine.

Is there any logging that i can enable to try to figure out what is
the problem on mono+linux ?

Thanks.

2009/3/20 Ken Egozi <ego...@gmail.com>:

c.sokun

unread,
Mar 22, 2009, 9:46:59 AM3/22/09
to Castle Project Development List
Try,
rules.Add(new PatternRoute("profilelist",
"/profile/list/[action]").DefaultForArea
().IsEmpty.DefaultForController().Is("profile").DefaultForAction().Is
("list"));

Ricardo Lopes

unread,
Mar 23, 2009, 6:51:20 PM3/23/09
to castle-pro...@googlegroups.com
It didn't work.

I also tried to change the route to this:

new PatternRoute("profilelist", "/profile/list")
.DefaultForArea().Is("edit").DefaultForController().Is("profile").DefaultForAction().Is("list");

And whe i tried the url http://127.0.0.1/profile/list

I got the same exception and stack trace, but it assumed the area to
be "profile/edit" instead of "edit":

Controller not found. Area: 'profile/edit' Controller Name: 'profile'



2009/3/22 c.sokun <chorn...@gmail.com>:
--

Ricardo Lopes

Rafael Teixeira

unread,
Mar 24, 2009, 10:38:03 AM3/24/09
to castle-pro...@googlegroups.com
It is probably a bug in Mono. Not sure if it is dealing with case-insensitiveness in reflection correctly, have you tried to use the route with "Profile" instead of "profile" for it's default value. Also how is your controller class named? if the "Controller" suffix is not correctly cased it may also fail.

If these variations work please enter a bug case in Mono's bugzilla.

Cheers
--
Rafael "Monoman" Teixeira
---------------------------------------
"I myself am made entirely of flaws, stitched together with good intentions."
Augusten Burroughs

Ricardo Lopes

unread,
Mar 27, 2009, 5:40:16 AM3/27/09
to castle-pro...@googlegroups.com
I am trying to identify the source of the bug.

The RoutingModuleEx is correctly rewriting the path, but when the
MonoRailHttpHandlerFactory is called it receives a context with
incorrect url, pathinfo, filepath, etc..

What happends between the RewritePath of the
RoutingModuleEx.OnBeginRequest() and the
MonoRailHttpHandlerFactory.GetHandler() that changes the url?

Thanks.

2009/3/24 Rafael Teixeira <mon...@gmail.com>:
--

Ricardo Lopes

Ricardo Lopes

unread,
Mar 31, 2009, 7:16:00 PM3/31/09
to castle-pro...@googlegroups.com
I was able to make the routing work without problem on mono, i removed
the "~" from the value returned by the CreateMonoRailPath(RouteMatch)
method on the RoutingModuleEx and routes seems to be working without
any problems (i have to test it a little bit more to be sure).


2009/3/27 Ricardo Lopes <rjl...@gmail.com>:
--

Ricardo Lopes
Reply all
Reply to author
Forward
0 new messages