EDIT: Added some extra logs at the end

I'm trying to make Mono 3.0 work on CentOS 6 with Apache. I have compiled Mono, mod_mono and the XPS server from the source. But now I'm getting errors because it doesn't seem to be pointing to the right place.

I want to store my files under /home/mvcgui/wwwroot/. I have put the 'apache' user in the mvcgui group. I've created a VHOST pointing there, like so:

<VirtualHost _default_:80>
        ServerAdmin webmaster@tralala.com
        DocumentRoot /home/mvcgui/wwwroot
#       ServerName mvcgui
        ErrorLog /home/mvcgui/logs/error.log
        <Directory />
                Options FollowSymLinks
        MonoServerPath mvc4 "/opt/mono/bin/mod-mono-server4"
        # Dev mode
        MonoDebug mvc4 true
        MonoSetEnv mvc4 MONO_IOMAP=all;PATH=/opt/mono/bin;LD_LIBRARY_PATH=/opt/mono/lib/:$LD_LIBRARY_PATH;

        MonoApplications mvc4 "/:/home/mvcgui/wwwroot"
        <Location />
        Allow from all
        Order allow,deny
        MonoSetServerAlias mvc4
        SetHandler mono
        SetOutputFilter DEFLATE

However when I make a request to localhost I get this error in the VHOST logs:

Fri Mar 22 15:52:35 2013] [error] [client ::1] (13)Permission denied: access to / denied

I believe however that the rights are correct?

[root@localhost mvcgui]# ls -l
total 8
drwxrwxr-x 2 mvcgui mvcgui 4096 Mar 22 11:41 logs
drwxrwxr-x 7 mvcgui mvcgui 4096 Mar 22 11:14 wwwroot

[root@localhost wwwroot]# ls -l
total 80
drwxr-xr-x 2 mvcgui mvcgui  4096 Mar 22 11:13 bin
drwxr-xr-x 5 mvcgui mvcgui  4096 Mar 22 11:13 Content
-rw-r--r-- 1 mvcgui mvcgui 32038 Mar 22 11:13 favicon.ico
-rw-r--r-- 1 mvcgui mvcgui  3790 Mar 22 11:13 Foundation_readme.txt
-rw-r--r-- 1 mvcgui mvcgui    97 Mar 22 11:13 Global.asax
-rw-r--r-- 1 mvcgui mvcgui   246 Mar 22 11:13 humans.txt
drwxr-xr-x 2 mvcgui mvcgui  4096 Mar 22 11:14 Images
-rw-r--r-- 1 mvcgui mvcgui  3103 Mar 22 11:13 packages.config
-rw-r--r-- 1 mvcgui mvcgui   110 Mar 22 11:13 robots.txt
drwxr-xr-x 3 mvcgui mvcgui  4096 Mar 22 11:14 Scripts
drwxr-xr-x 8 mvcgui mvcgui  4096 Mar 22 11:14 Views
-rw-r--r-- 1 mvcgui mvcgui  4543 Mar 22 11:13 Web.config
[root@localhost wwwroot]# 

Note that SELinux and iptables are disabled.

Where could I look to get more troubleshoot info?

EDIT: Under /etc/httpd/logs/error_log I have noticed a more detailed error that shows up only when I start the service:

[Mon Mar 25 09:48:37 2013] [notice] caught SIGTERM, shutting down
mod-mono-server received a shutdown message
[Mon Mar 25 09:48:38 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Mar 25 09:48:38 2013] [notice] Digest: generating secret for digest authentication ...
[Mon Mar 25 09:48:38 2013] [notice] Digest: done
[Mon Mar 25 09:48:38 2013] [notice] Apache/2.2.15 (Unix) DAV/2 mod_mono/2.10 configured -- resuming normal operations
Listening on: /tmp/mod_mono_server_global
Root directory: /
Listening on: /tmp/mod_mono_server_global
Root directory: /
Error: Address already in use
Exception caught during reading the configuration file:
System.MissingMethodException: Method not found: 'System.Configuration.IConfigurationSectionHandler.Create'.
  at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0
  at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <filename unknown>:0
  at Mono.WebServer.Apache.Server.get_AppSettings () [0x00001] in /home/arnaud/Downloads/xsp-2.10.2/src/Mono.WebServer.Apache/main.cs:208
  at Mono.WebServer.Apache.Server+ApplicationSettings..ctor () [0x0002a] in /home/arnaud/Downloads/xsp-2.10.2/src/Mono.WebServer.Apache/main.cs:63
Error: Directory "/home/mvcgui/wwwroot/" not found.
[root@localhost conf.d]#
  • The error concerning the Method not found was fixed by pointing the lib path from /opt/mono/lib/mono/4.0/mod-mono-server4.exe to /opt/mono/lib/mono/4.5/mod-mono-server4.exe. Mod-mono-server4.exe also had to be moved to the 4.5 lib directory. However the problem with the directory not being found is still happening and I have no idea why. Does mod-mono-server run as a different user than apache? – Astaar Mar 25 '13 at 9:27

I ran into the same problem on openSuse 13.1 after upgrading to Mono 3.2 and apache 2.4 The problem for me was actually a simple permission problem, my htdocs directory was not accessible by the mod-mono-server process.

I am using the User and Group directives of apache to set the ownership of the apache process. Previously, these settings where inherited by mod-mono-server, but this doesn't work in apache-2.4 due to a bug in mod_mono. You can check the user and group id mod-mono-server is running under with:

ps ax -o pid,user,group,ruser,rgroup,args|grep mono

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.