• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Mono / mod_mono setup - willing to pay for solution

dcollis

New Pleskian
Mono / mod_mono setup (CentOS 5)

I've been trying to get mod_mono to work on my server and have been failing miserably.
I want to be able to run MVC3 sites that require the latest version of Mono.

I have managed to install mod_mono & mono server via YUM (I am running CentOS 5) but can't work out how to configure an individual virtual site to use it.

I have been trying to configure this for a particular domain. Plesk appears to set things up so that each virtual site has it's own
conf directory: i.e. /var/www/vhosts/mydomain.com/conf/
In here, I think you are supposed to be able to add a vhost.conf that is used to configure the site, but nothing I do here seems to work (to get it to act as an MVC3 site using Mono).

Are there any gurus out there that might be able to offer some advice (or just do it for me - and explain how I can do it for future sites)? I am willing to pay for some you to do it if your rates are reasonable.

Thanks,
David
 
Last edited:
Well, I got something to work by taking the contents of the vhost.conf and putting it directly into the .include file that Plesk generates (which comes with a nice warning at the top telling you *not* to edit it and instead create the vhost.conf file).
However, doing this appears to allow the mono server to attempt to start up when i visit the domain in question. Although it now throws an exception immediately. But I think perhaps this is a question for the mono mailing list.

I will report back if I get any further, however, I would still be interested in what I am supposed to do rather than editing that .include file that Plesks warns me against doing...
 
Good news - Mono 2.10.2 is working on my server now.

The misleading errors I was getting in my httpd\error log turned out to be caused be dlls in my bin directory that shouldn't be there. You need to remove the majority of the System.*.dlls as well as Microsoft.Web.Infrastructure, leaving just these ones:
System.Web.Mvc
System.Web.Helpers
System.Web.Routing
System.Web.Razor
System.Web.WebPages
System.Web.WebPages.Razor
System.Web.WebPages.Deployment

With this in-place, I was able to get my MVC3 site to run.

So, now I just need to know how to make all of this Plesk-friendly. As I am fairly sure replacing the generated httpd.include file in my virtual host conf directory is the wrong way to go about this.

If anyone has an answer for me, please let me know.
 
A couple of other notes for other people who end up here looking for a solution:

Ensure you install mono-addon mod_mono-addon versions. If you still have mono standard installed it might have conflicts. yum remove anything that is version 1.x.

If you directly reference mono server paths if your conf file, then you don't need to worry. If you're going to sym links in /usr/bin then ensure they link to the correct version (delete & recreate if you need to).

In your main /etc/httpd/conf/httpd.conf:
Move the line:
Include conf.d/*.conf
To after the lines:
User apache
Group apache

In your /etc/httpd/conf.d:
The installer for me put in an incorrect path for the mod_mono.so (in the LoadModule line).
Change it to: LoadModule mono_module modules/mod_mono.so (if it isn't this).

If you are making https requests in your code (from your server to other servers), you'll need to jump through hoops: http://www.mono-project.com/FAQ:_Security (there are various ways to solve this problem, including turning it off, with a line such as this: ServicePointManager.ServerCertificateValidationCallback += (s, c, ch, ssl) => true;

If you are using MEF, don't try and use DirectoryCatelogs (this causes problems when indexing dlls that have no exports). If using MefContrib, you'll need to add your own custom MvcApplicationRegistry into the startup so it doesn't scan the entire bin folder.


Again, if anyone has an answer to how to this without over-writing Plesk generated conf files, I'd love to know :)
 
Back
Top