通过mod_mono在Mono 2.11.1上运行.NET4.0应用程序的例外情况

时间:2012-06-13 14:23:55

标签: .net asp.net-mvc apache mono mod-mono

昨天我在CentOS 5.7上安装了单声道版本2.11.1。从那时起,我无法通过mod_mono和Apache使我的.NET4.0应用程序工作,但我的.NET2.0应用程序工作正常。从命令行运行.NET4.0控制台应用程序也可以正常工作。

使用的版本:

  • mono 2.11.1
  • mod_mono 2.10
  • xsp 2.10.2
  • apache 2.2.21

我的Apache配置(相关部分):

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>

Apache错误日志中出现以下异常:

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

这看起来像是Mono,mod_mono,xsp中的错误还是完全不同的?

1 个答案:

答案 0 :(得分:1)

尝试使用以下标志运行XSP到单声道可执行文件:

- 调试=铸件

(从这里:http://tirania.org/blog/archive/2008/Apr-16-1.html

您可能需要安装脚本才能在系统中运行XSP。我的是/ usr / bin / xsp4。通过查看它,您将看到需要在MONO_OPTIONS env var中包含此标志,或者只是修改该文件以添加它。