【问题标题】:Deploying ASP.NET MVC Internet application with MySQL on Apache/mod_mono在 Apache/mod_mono 上使用 MySQL 部署 ASP.NET MVC Internet 应用程序
【发布时间】:2014-11-04 10:46:05
【问题描述】:

首先,我对所有这些东西都很陌生。

我使用装有 Visual Studio 2013 Ultimate 的 Windows 机器作为开发环境,并希望在使用 Apache/mod_mono 的 Linux 机器上托管创建的 Web 应用程序。

Linux机器运行:

  • CentOS 6.5 版(最终版)
  • Apache/2.2.15 (Unix) with mod_mono
  • Mono JIT 编译器版本 3.10.0(tarball,2014 年 10 月 4 日星期六 16:22:21 UTC)

我目前在 Linux 机器上托管 2 个 ASP.NET 应用程序:

  1. monotest:使用 MonoDevelop 模板创建的 MVC 项目,主要用于测试 apache 配置。此应用程序运行良好(即使重启 apache 时日志抛出错误)
  2. webappexample:一个 MVC3 项目,带有 razor 视图和使用 Visual Studio 模板创建的 MySQL 数据库。该网站给出“500 内部服务器错误”。

当我重新启动 Apache 时,此输出会打印在 error_log 中:

[Tue Nov 04 11:03:30 2014] [notice] SIGHUP received.  Attempting to restart
mod-mono-server received a shutdown message
Missing method System.Configuration.IConfigurationSectionHandler::Create(object,object,XmlNode) in assembly /opt/mono/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll, referenced in assembly /opt/mono/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
Missing method System.Configuration.IConfigurationSectionHandler::Create(object,object,XmlNode) in assembly /opt/mono/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll, referenced in assembly /opt/mono/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
Missing method System.Configuration.ConfigurationManager::get_AppSettings() in assembly /var/www/html/webappexample/bin/System.Configuration.dll, referenced in assembly /opt/mono/lib/mono/gac/Mono.WebServer2/0.4.0.0__0738eb9f132ed756/Mono.WebServer2.dll
mod-mono-server received a shutdown message
[Tue Nov 04 11:03:31 2014] [notice] Digest: generating secret for digest authentication ...
[Tue Nov 04 11:03:31 2014] [notice] Digest: done
[Tue Nov 04 11:03:32 2014] [notice] Apache/2.2.15 (Unix) DAV/2 mod_mono/2.11 PHP/5.4.32 configured -- resuming normal operations
mod-mono-server4
mod-mono-server4
mod-mono-server4
Listening on: /tmp/mod_mono_server_monotest
Root directory: /var/www/html/mono_test
Exception caught during reading the configuration file:
System.MissingMethodException: Method not found: 'System.Configuration.IConfigurationSectionHandler.Create'.
  at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x0000d] in /home/abuild/rpmbuild/BUILD/mono-3.10.0/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:62
  at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in /home/abuild/rpmbuild/BUILD/mono-3.10.0/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:159
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in /home/abuild/rpmbuild/BUILD/mono-3.10.0/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:173
  at Mono.WebServer.Apache.Server.get_AppSettings () [0x00001] in /home/abuild/rpmbuild/BUILD/xsp-1368532016/src/Mono.WebServer.Apache/main.cs:213
  at Mono.WebServer.Apache.Server+ApplicationSettings..ctor () [0x0002b] in /home/abuild/rpmbuild/BUILD/xsp-1368532016/src/Mono.WebServer.Apache/main.cs:63
mod-mono-server4
Listening on: /tmp/mod_mono_server_webappexample
Root directory: /var/www/html/webappexample

当我访问 webappexample 时,它​​在 error_log 中:

System.NullReferenceException: Object reference not set to an instance of an object
  at Mono.WebServer.BaseApplicationHost.EndOfRequest (Mono.WebServer.MonoWorkerRequest mwr) [0x0002b] in /home/abuild/rpmbuild/BUILD/xsp-1368532016/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) [0x00175] in /home/abuild/rpmbuild/BUILD/xsp-1368532016/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 Mono.WebServer.ModMonoWorker.InnerRun (System.Object state) [0x002a7] in /home/abuild/rpmbuild/BUILD/xsp-1368532016/src/Mono.WebServer.Apache/ModMonoWorker.cs:253
  at Mono.WebServer.ModMonoWorker.Run (System.Object state) [0x00004] in /home/abuild/rpmbuild/BUILD/xsp-1368532016/src/Mono.WebServer.Apache/ModMonoWorker.cs:92
[Tue Nov 04 11:37:55 2014] [error] (70014)End of file found: read_data failed
[Tue Nov 04 11:37:55 2014] [error] Command stream corrupted, last command was -1

经过一番谷歌搜索,我发现了很多关于复制某些 DLL 的博客文章。我已经忘记了到目前为止我尝试过的内容,但还没有解决我的问题。我也试过用单声道编译器编译 webappexample,编译时没有任何警告/错误,但仍然不能解决我的问题。

谁能在这里提供一些见解或解决方案?

【问题讨论】:

    标签: c# mysql asp.net-mvc apache mono


    【解决方案1】:

    你检查过你的 linux 机器上 mod_mono 的配置了吗?也许 mond_mono 配置为使用 aspnet v2 框架(.net v2、v3、v3.5),也许您的应用需要 v4 框架(.net v4、v4.5)

    我现在无法访问 linux 机器,但我相信 conf 文件位于 /mods-available/mod-mono.conf 下 该文件应该引用 mod-mono 的第 2 版或第 4 版

    我认为您还应该检查您的 apache 站点 /sites-available/.conf 的配置我相信这个 conf 文件也有一些 mod_mono 引用应该指向正确的版本。

    【讨论】:

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