Stránky

Monday, July 19, 2010

Installing ASP.NET with Mono on MAC

There are many partial tutorials on how to install ASP.NET on Mono in Linux machines but only few deal with problems that appear when trying to install this on Mac machine. The tutorial assumes that you have Apache 2.x installed somewhere on your machine. Below you'll find a small tutorial along with troubleshooting on mentioned issue.

  1. Download Mono from http://www.go-mono.com/mono-downloads/download.html
  2. Download xsp server and mod_mono from http://ftp.novell.com/pub/mono/sources-stable/. The xsp is simple server that is able to run .NET and mod_mono is an apache module that runs .NET
  3. Install Mono
  4. Install xsp
    1. Unzip xsp and locate the directory in your terminal
    2. Type:
      1. ./configure
      2. make
      3. sudo make install
    3. Troubleshooting: pkg-config does not exist on your machine. Install Darwin ports and then follow directions given here: http://pkgconfig.darwinports.com/. After install make sure that path to "port" installation is added to the $PATH variable.
  5. Install mod_mono
    1. Unzip mod_mono and locate the directory in your terminal
    2. Type:
      1. ./configure
      2. make
      3. sudo make install
    3. Check, where the mod_mono.conf has been installed
    4. Find your httpd.conf (on Snow Leopard by default it is located in /private/etc/apache2/httpd.conf also the mod_mono.conf should be located in the same directory)
    5. Edit httpd.config (sudo nano /private/etc/apache2.conf) and insert following line:

      Include /private/etc/apache2/mod_mono.conf
    6. Restart apache by typing:

      sudo apachectl restart
    7. Troubleshooting: Sometimes, when you try to view the .aspx page the server becomes unresponsive and you'll get: Service Temporarily Unavailable error. If you check your apache error log (/private/var/log/apache2/error_log) most probably you'll find following error there:

      Cannot open assembly '/usr/lib/mono/2.0/mod-mono-server2.exe': No such file or directory.

      The problem is, that system tries to search for default (Linux) installation directory. You need to modify again the httpd.conf file and insert following line:

      MonoServerPath /usr/bin/mod-mono-server

      Make sure that contents of /usr/bin/mod-mono-server are pointing to the correct installation of the Mono on your machine (e.g.:  
      exec /Library/Frameworks/Mono.framework/Versions/2.6.4/bin/mono $MONO_OPTIONS "/Library/Frame...
      )
  6. You are reday to go!

Well, I hope you've found this tutorial usefull. If so, drop me a message! :)

No comments:

Post a Comment