2014-11-04 114 views
0

首先,我對所有這些東西都很陌生。在Apache/mod_mono上使用MySQL部署ASP.NET MVC Internet應用程序

我將Windows機器與Visual Studio 2013 Ultimate一起用作開發環境,並且希望將所創建的Web應用程序託管在使用Apache/mod_mono的Linux機器上。

的Linux機器運行:

  • CentOS版本6.5(最終)
  • 阿帕奇/ 2.2.15(UNIX)與是mod_mono
  • 單聲道JIT編譯版本3.10.0(壓縮包星期六16年10月4日:22:21 UTC 2014)

我目前託管Linux機器上2個ASP.NET應用程序:

  1. monotest:一個使用MonoDevelop模板創建的MVC項目,主要用於測試apache配置。此應用程序工作正常(即使重新啓動Apache時發生日誌錯誤)
  2. webappexample:一個MVC3項目與剃刀視圖和MySQL數據庫創建與Visual Studio模板。這個網站給出了'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 

一些google搜索後,我遇到了不少有關複製某些DLL的博客文章。我失去了迄今爲止嘗試過的內容,但沒有解決我的問題。我也嘗試編譯與單聲道編譯器的webappexample,這編譯沒有任何警告/錯誤,但仍不能解決我的問題。

任何人都可以在這裏提供一些見解或解決方案嗎?

回答

0

你檢查過你的linux系統中mod_mono的配置嗎?也許mond_mono被配置爲使用aspnet v2框架(.net v2,v3,v3.5),也許您的應用需要v4框架(.net v4,v4.5)

我現在無法訪問linux盒子但我相信conf文件是在/mods-available/mod-mono.conf 該文件應該有一個引用版本2或4的mod-mono

我認爲你還應該檢查配置你的apache站點/sites-available/.conf我相信這個conf文件也有一些mod_mono引用應該指向正確的版本。