Reputation: 3485
A lot of information is available on how to set debug using xsp server for local development purposes, just an example from the official mono website:
I would like line numbers in my stack traces
By default xsp and xsp2 run in "release" mode, which means that no debugging information is generated at runtime. If you want line numbers in your stack traces, you must pass the --debug option to Mono, this is done by invoking xsp or xsp2 with the MONO_OPTIONS environment variable, like this:
$ MONO_OPTIONS=--debug xsp Listening on port: 8080 (non-secure) Listening on address: 0.0.0.0 Root directory: /tmp/us Hit Return to stop the server.
If you are running mod_mono with Apache, you must use the MonoDebug directive in your configuration file, like this:
MonoDebug true
Is it possible on nginx?
Upvotes: 3
Views: 3741
Reputation: 6814
I've just ran into the same problem myself and was able to fix it :)
The MONO_OPTIONS
environment variable can hold additional parameters that are passed to the mono executable. So if you do:
export MONO_OPTIONS="--debug"
fastcgi-mono-server-4 /applications="/:/srv/www/htdocs/mywebapp" /socket=tcp:127.0.0.1:9000
You should get debug information (linenumber and files) upon error, provided of course you also deployed the *.mdb files which hold the debug information.
I personally use a modified verison of the init script found here which is as follows:
#!/bin/sh
### BEGIN INIT INFO
# Provides: monoserve.sh
# Required-Start: $local_fs $syslog $remote_fs
# Required-Stop: $local_fs $syslog $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start fastcgi mono server with hosts
### END INIT INFO
source /etc/mono-addon-env
NAME=monoserver
DESC=monoserver
MONO_OPTIONS="--debug"
MONOSERVER=$(which fastcgi-mono-server4)
MONOSERVER_PID=$(ps auxf | grep fastcgi-mono-server4.exe | grep -v grep | awk '{print $2}')
WEBAPPS="/:/srv/www/htdocs/mywebapp/"
case "$1" in
start)
if [ -z "${MONOSERVER_PID}" ]; then
echo "starting mono server"
${MONOSERVER} /applications=${WEBAPPS} /socket=tcp:127.0.0.1:9000 &
echo "mono server started"
else
echo ${WEBAPPS}
echo "mono server is running"
fi
;;
stop)
if [ -n "${MONOSERVER_PID}" ]; then
kill ${MONOSERVER_PID}
echo "mono server stopped"
else
echo "mono server is not running"
fi
;;
esac
exit 0
But PAY ATTENTION: In case you use that init script to start up the fastcgi daemon, DO NOT USE any init tools like "service monoserve start" (RHEL/CentOS) or "rcMonoserve start". For me this will not work, I suspect the init system will spawn another process with different environment variables. To be safe, only call the script directly, i.e. /etc/init.d/monoserve start and put in in /etc/rc.local or such.
Upvotes: 4