Brian Nickel’s Online Journal

If you don’t C# you’ll B♭

Apache & fastcgi-mono-server, for the most part

Posted by Brian on August 9, 2007

When trying to figure out why all my requests were turning into “200 OK” from the Lighttpd and Cherokee, I discovered I’ve been sending them incorrectly, as HTTP style lines rather than CGI header style lines. Oops. With this change implemented, mod_fcgid is no longer failing on me and I’ve got what is the start of a configuration for Apache. PLEASE NOTE THIS IS NOT THE FINAL OR RECOMMENDED CONFIGURATION, but it is worth checking out.

<IfModule fcgid_module>
 <FilesMatch ".(aspx|asmx|ashx|asax|ascx|soap|rem|axd|cs|config|Config|dll)$>
    SetHandler fcgid-script
    FCGIWrapper /usr/bin/fastcgi-mono-server .aspx
    FCGIWrapper /usr/bin/fastcgi-mono-server .asmx
    FCGIWrapper /usr/bin/fastcgi-mono-server .ashx
    FCGIWrapper /usr/bin/fastcgi-mono-server .asax
    FCGIWrapper /usr/bin/fastcgi-mono-server .ascx
    FCGIWrapper /usr/bin/fastcgi-mono-server .soap
    FCGIWrapper /usr/bin/fastcgi-mono-server .rem
    FCGIWrapper /usr/bin/fastcgi-mono-server .axd
    FCGIWrapper /usr/bin/fastcgi-mono-server .cs
    FCGIWrapper /usr/bin/fastcgi-mono-server .config
    FCGIWrapper /usr/bin/fastcgi-mono-server .Config
    FCGIWrapper /usr/bin/fastcgi-mono-server .dll
    Options +ExecCGI
 </FilesMatch>

 DirectoryIndex index.aspx
 DirectoryIndex Default.aspx
 DirectoryIndex default.aspx
</IfModule>

There are two important shortcomings:

  1. Just wrapping extensions is not a recommended way of working with ASP.NET, as it lacks certain security and management features. It is better to just send the whole directory to the Mono server. (More on this, Friday.) As far as I understand it, this will require a change in mod_fcgid.
  2. WebResource.axd shows up as a 404 error rather than the expected resource, this can be overcome hackishly by creating an empty WebResource.axd where the other one is expected. Does anyone who knows Apache know how to overcome this?

Sincerely,
Brian Nickel

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>