Documentation · Programming · Summer of Code 2007

Want to test fastcgi-mono-server? Here’s the scoop.

Subtitle: What you need to know about Cherokee, Lighttpd, and Apache2.

Last Friday, I made it possible to compile and install your own copy of “fastcgi-mono-server” using standard methods. Now I have some in depth information on how to configure your server and what to look out for.


Lighty works fantastic. With about 5 minutes of configuration, you can get ASP.NET and all its glory running. Simply follow the instructions located here or in the “doc/linux/” directory of the source package.


Cherokee, up to and including Cherokee 0.5.6, has a bug where it fails to send an empty Stdin record if no input data is present. I could write a hack to get around this problem, but I’m holding out for now. The Cherokee 0.6 series, on the other hand, works very well with fastcgi-mono-server. If you’re ready to move to the 0.6 series, follow the instructions located here or in the “doc/linux/” directory of the source package.


Apache’s FastCGI situation is problematic. There are currently 2 implementations of FastCGI that I’m aware of: mod_fastcgi and mod_fcgid, and neither one of them is working just right. Mod_fastcgi was designed by the authors of FastCGI to be a replacement for CGI (hence the name), and is strongly tied to the paradigm of each file being its own application. It does have some tricks which would let a single server be used, but it sends some very unusual and sometimes junk parameters back to the server. It would require some major hacks to transform its parameters back into values that the server could understand.

Mod_fcgid, on the other hand, has the advantage of being younger, hipper, and more in tune with the concept of script servers. It is almost perfect except for the fact it sends the entire contents of the response to the server rather than stripping off the status line and sending it as r->status_line. This causes Apache to reject the response and display an error message. fastcgi-mono-server doesn’t send a status line of the status is 200 (Ok), so it’ll only work for pages that don’t do anything fancy or crash.


10 thoughts on “Want to test fastcgi-mono-server? Here’s the scoop.

  1. I think you should fit with the standard (description) of fastcgi.
    When you find issues like the one with Cherokee < 0.6 and the others with Apache you should ensure that issues are not inside the standard and then report them to the maintainers.
    It’s better having an standard implementation of FastCGI that fit with the concrete implementation of any server.
    If working with those servers is essential, I encourage you to make a fork of the FastCGI modules and ensure they work in the standard way. I think that changing Cherokee or Apache/mod_fcgid could be easy.

  2. Hi Brian:

    I did compile fastcgi in OSX 10.4.9 and it did without a problem… I´m using mono 1.2.5 from one of the preview packages, my problem is that if I try running the fastgci from command line like this:
    sudo fastcgi-mono-server2 /socket=tcp: /verbose=True

    Fire up firefox to navigate to localhost:8080 the page never finish loading it just keep going, I see this same behavior with fastcgi-mono-server, but if I run xsp2 it responds right away.

    The only output that I get from fastcgi is:
    Listening on port:
    Listening on address: 8080
    Root directory: /usr/local/var/www
    Max connections: 1024
    Max requests: 1024
    Multiplex connections: False
    Use /stopable=True to enable stopping from the console.

    Do you have any suggestion on where ca I look to debug or find a solution for this?


  3. Mario,

    It looks like you’re running the FastCGI Mono Server on 8080 and trying to access it as a web page in Firefox. FastCGI is something that needs to be dispatched from your web server, EG, Cherokee is running on port 8080, and the FastCGI Mono Server is running on some other port. Then, whenever a request is made to a .aspx, it is forwarded to the Mono Server. I’ve added a diagram and explanation of how requests are made here:

    See for an explanation of how to configure Cherokee.

    – Brian

  4. Can’t get this running on FreeBSD 6.2 and lighttpd-1.4.16. Keep getting a plugin error from lighty that the fastcgi plugin failed to load because no host/port specified. Even though it was per your directions for lighty on Linux. Any suggestions?

  5. Brian;

    Thx for your help, It’s working, I was trying to access pages on port 8002, but now I see that I have to use the port on which I have cherokee listen.

    I just want to add that I had to create a .wapi dir inside /var/empty because fastcgi was failing to serve the page, and this .wapi dir need write permissions for the account that cherokee is running.

    Thanks Brian

  6. Brian,

    Here is the config:

    FreeBSD 6.2 / Lighttpd-1.4.16:


    server.modules = (
    # “mod_rewrite”,
    # “mod_redirect”,
    # “mod_alias”,
    # “mod_cml”,
    # “mod_trigger_b4_dl”,
    # “mod_auth”,
    # “mod_status”,
    # “mod_setenv”,
    # “mod_proxy”,
    # “mod_simple_vhost”,
    # “mod_evhost”,
    # “mod_userdir”,
    # “mod_cgi”,
    # “mod_compress”,
    # “mod_ssi”,
    # “mod_usertrack”,
    # “mod_expire”,
    # “mod_secdownload”,
    # “mod_rrdtool”,
    “mod_accesslog” )

    index-file.names = (

    fastcgi.server = (
    “.php” => ((
    “socket” => “/tmp/php-fastcgi.socket”,
    “bin-path” => “/usr/local/bin/php-cgi”
    “.aspx” => ((
    “host” => “192.168.x.x”,
    “port” => 9050,
    “socket” => “/tmp/fastcgi-mono-server”,
    “bin-path” => “/usr/local/bin/fastcgi-mono-server2”,
    “max-procs” => 1,
    “check-local” => “disable”

    // added this whole block: = (
    “.asmx” => “.aspx”,
    “.ashx” => “.aspx”,
    “.asax” => “.aspx”,
    “.ascx” => “.aspx”,
    “.soap” => “.aspx”,
    “.rem” => “.aspx”,
    “.axd” => “.aspx”,
    “.cs” => “.aspx”,
    “.config” => “.aspx”,
    “.dll” => “.aspx”

    The I start the fastcgi mono server:
    /usr/local/bin/fastcgi-mono-server2 /socket=tcp:9050

    Then I try to start the lighttpd and get an error ref’ing this line: “.aspx” => (( … and module can’t load.

    After I did this I noticed you have several install procedures for the mono server. I may not be using the most recent. Can you help me out?

  7. Went back and read another post and got it working, I think? It runs a page, but not sure if correct:

    Here are my changes to the lighttpd.conf file:

    – server.modules is the same.

    # which extensions should not be handle via static-file transfer
    # .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
    static-file.exclude-extensions = ( “.aspx” (added this), “.php”, “.pl”, “.fcgi” )

    changed this to:
    fastcgi.server = (
    “.php” => ((
    “socket” => “/tmp/php-fastcgi.socket”,
    “bin-path” => “/usr/local/bin/php-cgi”
    “.aspx” => (( “host” => “”, “port” => 1234 )),
    “.asmx” => (( “host” => “”, “port” => 1234 )),
    “.ashx” => (( “host” => “”, “port” => 1234 )),
    “.asax” => (( “host” => “”, “port” => 1234 )),
    “.ascx” => (( “host” => “”, “port” => 1234 )),
    “.soap” => (( “host” => “”, “port” => 1234 )),
    “.rem” => (( “host” => “”, “port” => 1234 )),
    “.axd” => (( “host” => “”, “port” => 1234 )),
    “.cs” => (( “host” => “”, “port” => 1234 )),
    “.config” => (( “host” => “”, “port” => 1234 )),
    “.dll” => (( “host” => “”, “port” => 1234 ))

    – took out

    The I start the fastcgi mono server:
    /usr/local/bin/fastcgi-mono-server2 /socket=tcp:1234 /automappaths /root=/usr/local/www/data/

    – Requested a test page that displays properties of Request Object. Had some errors because some properties don’t seem to be implemented in mono. Took them out and worked fine… even with postback.

    Let me know if this config is correct?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s