Marijn Giesen
Marijn Giesen

Reputation: 11

Exceptions running .NET4.0 apps on Mono 2.11.1 via mod_mono

Yesterday I've installed mono version 2.11.1 on CentOS 5.7. Since then, I can't get my .NET4.0 applications to work via mod_mono and Apache, but my .NET2.0 applications work fine. Running a .NET4.0 console app from the command line works fine as well.

Versions used:

My Apache config (the relevant part):

Alias /testproject "/var/www/sites/testproject"

MonoServerPath testproject "/usr/bin/mod-mono-server4"
MonoAutoApplication disabled
MonoDebug testproject true
MonoSetEnv testproject MONO_IOMAP=all
MonoApplications testproject "/testproject:/var/www/sites/testproject"

<Location /testproject>
        SetHandler mono
        MonoSetServerAlias testproject
</Location>

The following exceptions appear in the Apache error log:

mod-mono-server4
Listening on: /tmp/mod_mono_server_testproject
Root directory: /
Worker initialization exception occurred. Continuing anyway:
System.InvalidCastException: Cannot cast from source type to destination type.
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <filename unknown>:0
  at Mono.WebServer.ModMonoWorkerRequest..cctor () [0x00035] in /root/xsp-2.10.2/src/Mono.WebServer.Apache/ModMonoWorkerRequest.cs:86
System.NullReferenceException: Object reference not set to an instance of an object

Server stack trace:
  at Mono.WebServer.BaseApplicationHost.EndOfRequest (Mono.WebServer.MonoWorkerRequest mwr) [0x00029] in /root/xsp-2.10.2/src/Mono.WebServer/BaseApplicationHost.cs:141
  at Mono.WebServer.ModMonoApplicationHost.ProcessRequest (Int32 reqId, System.String verb, System.String queryString, System.String path, System.String protocol, System.String localAddress, Int32 serverPort, System.String remoteAddress, Int32 remotePort, System.String remoteName, System.String[] headers, System.String[] headerValues, System.Object worker) [0x00173] in /root/xsp-2.10.2/src/Mono.WebServer.Apache/ModMonoApplicationHost.cs:109
  at (wrapper remoting-invoke-with-check) Mono.WebServer.ModMonoApplicationHost:ProcessRequest (int,string,string,string,string,string,int,string,int,string,string[],string[],object)
  at (wrapper xdomain-dispatch) Mono.WebServer.ModMonoApplicationHost:ProcessRequest (object,byte[]&,byte[]&,int,string,string,string,string,string,int,string,int,string,string[],string[])

Exception rethrown at [0]:

  at (wrapper xdomain-invoke) Mono.WebServer.ModMonoApplicationHost:ProcessRequest (int,string,string,string,string,string,int,string,int,string,string[],string[],object)
  at (wrapper remoting-invoke-with-check) Mono.WebServer.ModMonoApplicationHost:ProcessRequest (int,string,string,string,string,string,int,string,int,string,string[],string[],object)
  at Mono.WebServer.ModMonoWorker.InnerRun (System.Object state) [0x00199] in /root/xsp-2.10.2/src/Mono.WebServer.Apache/ModMonoWorker.cs:239
  at Mono.WebServer.ModMonoWorker.Run (System.Object state) [0x00002] in /root/xsp-2.10.2/src/Mono.WebServer.Apache/ModMonoWorker.cs:92
[Wed Jun 13 14:58:31 2012] [error] (70014)End of file found: read_data failed
[Wed Jun 13 14:58:31 2012] [error] Command stream corrupted, last command was -1

Does this look like a bug in Mono, mod_mono, xsp or is it something else entirely?

Upvotes: 1

Views: 1720

Answers (1)

knocte
knocte

Reputation: 17979

Try running XSP with the following flag to the mono executable:

--debug=casts

(From here: http://tirania.org/blog/archive/2008/Apr-16-1.html )

You probably have a script install to run XSP in your system. In mine it's /usr/bin/xsp4. By looking at it you will see that you need to include this flag in MONO_OPTIONS env var, or just modify that file to add it.

Upvotes: 1

Related Questions