2012-11-27 74 views
4

我在Apache中使用mod-mono託管ServiceStack Web服務,我有mono-3.0.0,和xsp-2.10.2。 我主辦了以.Net framework 2.0爲目標的hello world示例,並使用mod-mono-server2,並且它工作正常。 然後,我將項目更改爲.Net Framework 4.0並使用mod-mono-server4。 我得到這個錯誤:單聲道3.0.0:無法加載文件或程序集:System.Web.Extensions.dll,版本= 4.0.0.0

Could not load file or assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, Boolean refonly) [0x00000] in :0 at System.AppDomain.Load (System.String assemblyString) [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.AppDomain:Load (string) at System.Reflection.Assembly.Load (System.String assemblyString) [0x00000] in :0 at System.Web.Compilation.BuildManager.LoadAssembly (System.Web.Configuration.AssemblyInfo info, System.Collections.Generic.List`1 al) [0x00000] in :0 at System.Web.Compilation.BuildManager.GetReferencedAssemblies() [0x00000] in :0 at System.Web.Compilation.BuildManager.CallPreStartMethods() [0x00000] in :0

但文件System.Web.Extensions程序安裝在GAC:

gacutil -l System.Web.Extensions

The following assemblies are installed into the GAC: System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 Number of items = 3

即使我設置MonoPath專門拿到4.0版本,則會出現同樣的錯誤:

MonoPath /usr/local/lib/mono/4.0

我也注意到了這一點:

Version information: Mono Runtime Version: 2.10.5 (tarball Fri Oct 28 10:20:24 IST 2011); ASP.NET Version: 4.0.30319.1

單聲道運行時版本說2.10.5,雖然我已安裝mono-3.0.0,我不知道這個信息是否對這個問題有價值。

我試圖直接運行MOD-單服務器4,我得到這個錯誤信息:

mod-mono-server4

mod-mono-server4 Missing method System.Configuration.IConfigurationSectionHandler::Create(object,object,XmlNode) in assembly /usr/local/lib/mono/4.0/System.dll, referenced in assembly /usr/local/lib/mono/4.0/System.Configuration.dll 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) [0x00000] in :0 at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in :0 at System.Configuration.ConfigurationManager.get_AppSettings() [0x00000] in :0 at Mono.WebServer.Apache.Server.get_AppSettings() [0x00000] in :0 at Mono.WebServer.Apache.Server+ApplicationSettings..ctor() [0x00000] in :0 mod-mono-server4 Listening on: /tmp/mod_mono_server Root directory: /usr/local/bin Error: There's already a server listening on /tmp/mod_mono_server

我用Google搜索這個錯誤,它使我這個錯誤:

https://bugzilla.xamarin.com/show_bug.cgi?id=7967

也許錯誤在mod-mono-server4上是另一個bug的起源......我將嘗試獲取xsp 3.0並查看它是否解決了這個問題。

任何想法?

感謝

+1

你是如何安裝Mono 3.0的?對我來說,它看起來像你從源代碼編譯,但配置了錯誤的前綴。 –

+0

我遵循這個指示:http://wiki.phonicuk.com/Installing-Mono-in-CentOS-5-x.ashx我剛剛改變了「mono-2.10.8.tar.gz」for「mono-3.0.0 .tar.bz2「 –

+0

您應該關心'./configure --prefix =/usr/local'部分。執行'whereis mono'命令並查看第一個前綴是什麼。 '/ usr'也許?在這種情況下,再次使用已獲得的前綴執行此過程。之後運行'mono --version'確定。 –

回答

5

此錯誤是因爲在Mono的實現通過將mod_mono/XSP使用時.NET 4.0框架的System.Configuration組裝的問題造成的。它試圖讀入「MonoServerDefaultIndexFiles」appSetting鍵,但找不到Create工廠方法。

花了AA兩天找出瞭解決方法是編輯以下文件...通過改變4.0默認值

/opt/mono/bin/mod-mono-server4

...到4.5在這條線:

exec /opt/mono/bin/mono $MONO_OPTIONS "/opt/mono/lib/mono/4.5/mod-mono-server4.exe" "[email protected]"

有了這個決心,我面臨的下一個問題是一個事實,即單取代了建於AspNetMembershipProvider與一個SqliteMembershipProvider通過它的Settings Map功能。我加入我的web.config的appSettings部分以下行來禁用此默認行爲:

"<add key="MonoAspnetInhibitSettingsMap" value="disabled"/>"

後追逐的夫婦日子裏,我MVC3應用程序已成功在Mono 3.0.3運行(在最新的這篇文章的時候寫)/ XSP 2.10/Mod_Mono 2.10

+1

更多信息在http://stackoverflow.com/questions/12961694/mono-2-11-with-nginx-or-apache – nickvane

相關問題