1

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

使用的版本:

  • 单声道 2.11.1
  • mod_mono 2.10
  • xsp 2.10.2
  • 阿帕奇 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 中的错误,还是完全不同?

4

1 回答 1

1

尝试将带有以下标志的 XSP 运行到 mono 可执行文件:

--debug=casts

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

您可能已经安装了一个脚本来在您的系统中运行 XSP。在我这里是 /usr/bin/xsp4。通过查看它,您会发现您需要在 MONO_OPTIONS 环境变量中包含此标志,或者只需修改该文件以添加它。

于 2012-06-13T16:53:48.127 回答