[Mono-list] Problems with System.Web.Routing

Chad Wackerman chadwackerman at gmail.com
Fri Jan 14 14:19:09 EST 2011


I'm having a series of odd issues with System.Web.Routing. I'm
manually adding routes -- this isn't MVC.

First problem is that routing doesn't work at all unless I create a
.htaccess file in the root with "ForceType application/x-asp-net". I
tried setting the handler in the apache.conf but that didn't work. In
fact, that broke the .htaccess hack. There are lots of conflicting
docs on this. (Also vhosts containing mod_mono parameters are broken
under CentOS due to a security/startup order issue -- there's an old
bug there.) Any clues?

Second: on Mono 2.6.7 if I create a route "test" I can access it as
"test" and "test/". But under Mono, the second path isn't recognized.
If I copy Microsoft's System.Web.Routing to the server, the behavior
matches, so I don't believe Apache/mod_mono/xsp is tinkering with the
path resolution.

After spending quite a bit of time sorting out Makefile weirdness that
stumped every blog post and stackoverflow article I could find
(https://bugzilla.novell.com/show_bug.cgi?id=645212) I successfully
moved forward to Mono 2.8.2 to see if anything changed. On Mono 2.8.2
the trailing slash issue appears resolved. I can remove the local copy
of Microsoft System.Web.Routing and everything works. However if I
bump to the .NET 4.0 profile, the issue returns. Under 4.0
System.Web.Routing is an empty assembly. Did an older file get pulled
into System.Web? Did some MVC fix break the interaction with the base
class? The whole MVC/Routing thing seems shaky on Mono right now.

Now for the strange one:

While testing, many times I managed to get myself into a situation
where routes stopped working altogether. I finally discovered stuff
left in the /tmp directory. (Shutdown is clean, you can reproduce this
every time.) That should get cleaned up when mod_mono exits as it
seems to cause chaos if you switch .NET profiles or delete routes or
change Global.asax between versions, even if you kill the mono process
and/or restart Apache.

In some cases, I even managed to get pages from different sites on the
same server while testing. This is, predictably, hard to reproduce but
hopefully this is enough of a report to track it down. (See note on
MonoSetServerAlias below.)

Finally, and this may be related -- how are those cache/init keys in
/tmp determined? Is it robust? I have multiple vhosts pointing to the
same files -- think SSL and non-SSL versions -- and, well, strange
things happen. I tried symlinks and even copying the files separately
and it didn't help. Is it pulling the build version or something?

The bug: I have a "status" route pointing to www/html/site/Status.Aspx
mapped to two sites (same code, same directory even):

http://server.com/status -- works
http://server.com:443/status -- fails with a 404

I can restart Apache and the behavior persists. But if I delete the
tmp directory, I can reverse it:

http://server.com:443/status -- now works
http://server.com/status -- worked before, now fails with 404

Basically the first site wins.

I've explored MonoSetServerAlias and things that seem related. Usually
this just opens a larger can of worms. Conflicting documentation for
fastcgi vs mod_mono, long-standing unresolved bugs that smell vaguely
similar, and so forth.

Anyway, some clues would be appreciated. I feel like I've done due
diligence chasing my tail on this one. :)


More information about the Mono-list mailing list