Installing mod_mono on Ubuntu: handler doesn't seem to get registered
I'm trying to install mod_mono on Apache 2 (Prefork MPM). I'm using Ubuntu Karmic, and just want an auto-hosting setup (so that any .aspx files are executed, similar to how PHP is normally setup).
I did the following to install Mono:
$ apt-get install libapache2-mod-mono mono-apache-server2 mono-devel
$ a2dismod mod_mono
$ a2enmod mod_mono_auto
I've confirmed that mod_mono is getting loaded by Apache. However, any .aspx pages I try to load are returned unprocessed and still have an application/x-asp-net
MIME type. It's as if the mod_mono handler never gets registered with Apache.
Here's the contents of /etc/mod_mono_auto.load
:
LoadModule mono_module /usr/lib/apache2/modules/mod_mono.so
And here's /etc/mod_mono_auto.conf
:
MonoAutoApplication enabled
AddType application/x-asp-net .aspx
AddType application/x-asp-net .asmx
AddType application/x-asp-net .ashx
AddType application/x-asp-net .asax
AddType application/x-asp-net .ascx
AddType application/x-asp-net .soap
AddType application/x-asp-net .rem
AddType application/x-asp-net .axd
AddType application/x-asp-net .cs
AddType application/x-asp-net .config
AddType application/x-asp-net .dll
DirectoryIndex index.aspx
DirectoryIndex Default.aspx
DirectoryIndex default.aspx
I've even tried setting the handler explicitly:
AddHandler mono .aspx .ascx .asax .ashx .config .cs .asmx .asp
Nothing seems to help. Any ideas how to get this working?
Solution 1:
Please be aware mono is not like php. Even just serving one page requires a mono application to start up. It is important how you structure your aspx files (read: web application).
I have seen cases where SetHandler is required to force apache to send requests to mono-server.
Try something like...
<LocationMatch "\.(aspx)$">
SetHandler mono
</LocationMatch>