I have Mono 3.0.6 up and running on a CentOS 6/Apache 2 setup. I have published an ASP.NET 4.5/MVC4 website on the server. However, when I try to reach the website I get a status code 503 (Service Temporarily Unavailable), and in the logs I can see that Mono is not even trying to catch the request (as it should try to route me from / to /Home/):
[Tue Mar 26 14:18:38 2013] [error] [client 192.168.40.1] Directory index forbidden by Options directive: /var/www/mvcgui/wwwroot/
I'm using the default Apache configuration, and copied mod_mono.conf to /etc/httpd/conf.d/00-mod_mono.conf. My VHOST is in the same directory as 01-mvcgui.conf (to make sure it's loaded after Mono). This is my vhost:
<VirtualHost _default_:80>
ServerAdmin [email protected]
DocumentRoot /var/www/mvcgui/wwwroot
ServerName 192.168.40.132
ErrorLog /var/www/mvcgui/error.log
CustomLog /var/www/mvcgui/requests.log combined
## Mono-specific configuration ##
MonoServerPath mvcgui "/opt/mono/bin/mod-mono-server4"
MonoDebug mvcgui true
MonoSetEnv mvcgui MONO_IOMAP=all
MonoApplications mvcgui "/:/var/www/mvcgui/wwwroot"
## End Mono-specific configuration
<Location />
MonoSetServerAlias mvcgui
SetHandler mono
</Location>
</VirtualHost>
I suspect the requests are not being passed on to Mono. How could I make sure it's the case?
Of course, after 1 day spent on this I found the solution 5 minutes after posting here. I thought I'd share the result. For ASP.NET 4.5/MVC4, you need to change the path into which mod-mono-server4 gets the lib.
Edit the file:
And in it change that line :
With this one:
I suspect that Mono wasn't 'intercepting' the requests because the server didn't start properly because of that lib path issue. Now I'm getting the .NET pages as expected.