【问题标题】:Exceptions running .NET4.0 apps on Mono 2.11.1 via mod_mono通过 mod_mono 在 Mono 2.11.1 上运行 .NET4.0 应用程序的异常
【发布时间】:2012-06-13 14:23:54
【问题描述】:

昨天我在 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 中的错误还是完全是其他东西?

【问题讨论】:

  • 我会先将 mod_mono 和 xsp 设置为与 Mono 包相同的版本。
  • 是的,这也是我的第一个猜测,但没有 mod_mono 和 xsp 版本 2.11.1(参见 download.mono-project.com/sources

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


【解决方案1】:

尝试在单声道可执行文件中运行带有以下标志的 XSP:

--debug=casts

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-03
    相关资源
    最近更新 更多