You are here

Running ASP.Net with Lighttpd on FreeBSD

Ivan Radovanovic's picture

As a first step for running asp.net applications using lighttpd webserver on FreeBSD you need to download source for xsp from mono project site. Here follow instructions for patching and compiling this source in order to run (hopefully) better on FreeBSD. These instructions apply to xsp-2.10.2

You need to patch following files
1. src/Mono.WebServer.FastCgi/Record.cs (patch Record.cs < Record.cs.diff)
2. src/Mono.WebServer.FastCgi/UnmanagedSocket.cs
3. src/Mono.WebServer.FastCgi/main.cs

After compiling and installing patched xsp you should configure lighttpd. You can follow instructions given at http://www.mono-project.com/FastCGI_Lighttpd, I personally prefer approach with mapping only appropriate extensions to mono. NOTE: extension list on linked website doesn't seem to be really complete (for example .mdb should also probably be handled to mono, or it should be explicitly forbidden).

P.S.
There is attached port (xsp.tar.bz2) for automatically doing this patching (and you can also install xsp using it - if you want to replace original FreeBSD port with this one make sure to uncomment the line saying

.include "${.CURDIR}/../../lang/mono/bsd.mono.mk"

and comment out line above it

UPDATE 2014-12-06
You can download set of patches for latest version of xsp from https://github.com/ir-soeasycorp/xsp - apparently they improved somewhat code for xsp, but old problems with BSD support remained, and also few serious bugs with socket handling affecting all operating systems are still there. I sent pull request but it seems nobody really cares to merge that into main repository. (I will probably update fork I created from time to time).
You can do simple ./autogen.sh and gmake install after to compile and install (install part reports few errors which can be ignored).