Trying to run an ASP.NET MVC application using Mono on Apache with FastCGI

apache-2.2asp.netfastcgimono

I have a hosting account with DreamHost and I would like to use the same account to run ASP.NET applications. I have an application deployed in a subdomain, a .htaccess with a handler like this:

# Define the FastCGI Mono launcher as an Apache handler and let
# it manage this web-application (its files and subdirectories)
SetHandler monoWrapper
Action monoWrapper /home/arienh4/<domain>/cgi-bin/mono.fcgi virtual

My mono.fcgi is set up as such:

#!/bin/sh
#umask 0077
exec >>/home/arienh4/tmp/mono-fcgi.log
exec 2>>/home/arienh4/tmp/mono-fcgi.err

echo $(date +"[%F %T]") Starting fastcgi-mono-server2

cd /
chmod 0700 /home/arienh4/tmp/mono-fcgi.sock
echo $$>/home/arienh4/tmp/mono-fcgi.pid
# stdin is the socket handle
export PATH="/home/arienh4/mono/bin:$PATH"
export LD_LIBRARY_PATH="/home/arienh4/mono/lib:$LD_LIBRARY_PATH"
export TMP="/home/arienh4/tmp"
export MONO_SHARED_DIR="/home/arienh4/tmp"
exec /home/arienh4/mono/bin/mono /home/arienh4/mono/lib/mono/2.0/fastcgi-mono-server2.exe \
/logfile=/home/arienh4/logs/fastcgi-mono-web.log /loglevels=All \
/applications=/:/home/arienh4/<domain>

I took this from the Mono site for CGI. I'm not sure if I'm doing it correctly though. This code is resulting in this error:

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

I have no idea what's causing this. As far as I can see, Mono isn't even hit (no log files are created).

Best Answer

Do you have any ModRewrite scripts running? Usually an incorrect ModRewrite which causes an infinite loop would cause this.

You might want to turn on the mod_cgi "ScriptLog" directive which will log the execution of your CGI script.

Related Topic