Developing for .NET on the Mac, Part 2: Serving ASP.NET Pages
Prerequisites:
- I'm assuming that you've already read and followed Part 1 of this series. At a minimum, you should have:
- The Subversion client
- A directory for Subversion checkouts (which I refer to as ~/src/mono)
- A binary distribution of Mono from their website
- Open a terminal and go to ~/src/mono.
- Check out the code for mod_mono. This command should get the job done: svn checkout svn://anonsvn.mono-project.com/source/trunk/mod_mono.
- Go to ~/src/mono/mod_mono and run the command ./autogen.sh --prefix=/Library/Frameworks/Mono.framework/Versions/Current.
- Update: on a fresh install of Leopard, I found that autogen.sh and configure were failing because a tool named libtoolize was renamed to glibtoolize, and the configuration scripts were not configured to handle this. You can fix the problem either by creating an alias for libtoolize or by editing the single line in autogen.sh that refers to libtoolize to point to glibtoolize, instead; furthermore, based on what I read here, it seems that the configuration script fails to detect the 64-bit architecture on some Macs. If this happens to you (you'll know because Apache will fail to start up), run CFLAGS="-m64" ./autogen.sh --prefix=/Library/Frameworks/Mono.framework/Versions/Current followed by a make clean and make.
- Follow this by running make && make install. Note that you will probably need elevated permission to complete the installation ste.
- Edit /etc/httpd/httpd.conf and add this to the end of the file: Include /private/etc/httpd/mod_mono.conf. Update: in Leopard, this is /etc/apache2/httpd.conf.
- Open System Preferences and select "Sharing".
- Check the box next to "Personal Web Sharing".
It should be noted that many applications will require more advanced setup than this (for example, applications like the CruiseControl.NET web dashboard want to be able to handle all web requests for their directory, not just the ones pointing to aspx files), but this is a topic for another post.