我一直试图让MVC3网站在CentOs 6.5上运行apache服务器。单声道似乎工作正常,我可以很好地运行一个简单的MVC3网站,但当我将MySql连接器添加到我的项目时,我得到一个"内部服务器错误"在页面上和长httpd日志错误说明:
"执行本机代码时获得了SIGABRT。这通常表示单声道运行时或应用程序使用的本机库之一出现致命错误。"
我似乎无法找到解决此问题的方法,任何人都可以帮我解决这个问题或建议我应该使用哪些软件包和版本,如果我的当前设置不是推荐的方式?我的目标是建立一个与MySql db连接的MVC3站点,我非常感谢你的帮助。
我正在使用.Net Framework 4.我添加了NuGet包MySql.Data 6.8.3和MySql.Data.Entity 6.7.5,我的EntityFramework是版本5.0.0。
我已在以下程序集上将copy local属性设置为true:
System.Web.Helpers
System.Web.Mvc
System.Web.Providers
System.Web.Razor
System.Web.Routing
System.Web.WebPages
System.Web.WebPages.Razor
System.Web.WebPages.Deployment
...而且对于Microsoft.Web.Infrastructure尤其错误。
这里有更多细节:
在httpd error_log中我得到的日志中有一个可读的错误(除了我认为是单声道堆栈跟踪条目等):
Native stacktrace:
/opt/mono/bin/mono() [0x80f0412]
[0xb7785600]
Debug info from gdb:
warning: File "/opt/mono/bin/mono-sgen-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "/usr/share/gdb/auto-load:/usr/lib/debug:/usr/bin/mono-gdb.py".
To enable execution of this file add
add-auto-load-safe-path /opt/mono/bin/mono-sgen-gdb.py
line to your configuration file "$HOME/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "$HOME/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
我不太了解python脚本,但我不认为我应该调整这些东西只是为了让一个简单的网站工作。我不知道多少,我试图创建一个文件.gdbinit并添加该行,但它没有任何效果。
好的,新的发展: 按照说明我从/ opt / mono下卸载了我的mono和mod_mono安装,并使用前缀/ usr安装了所有内容。
有些东西仍然关闭,现在我可以像以前一样没有错误重启httpd但是运行我的mvc3站点会导致httpd错误日志中出现nullreferenceexception:
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 () [0x00000] in <filename unknown>:0
System.NullReferenceException: Object reference not set to an instance of an object
Server stack trace:
at Mono.WebServer.BaseApplicationHost.EndOfRequest (Mono.WebServer.MonoWorkerRequest mwr) [0x00000] in <filename unknown>:0
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) [0x00000] in <filename unknown>:0
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) [0x00000] in <filename unknown>:0
at Mono.WebServer.ModMonoWorker.Run (System.Object state) [0x00000] in <filename unknown>:0
[Thu May 08 15:38:55 2014] [error] (70014)End of file found: read_data failed
[Thu May 08 15:38:55 2014] [error] Command stream corrupted, last command was -1
任何可能导致这种情况的想法?我在mod_mono.conf上添加了以下内容:
MonoServerPath&#34; / usr / bin / mod-mono-server4&#34;
启用MonoAutoApplication
MonoUnixSocket / tmp / mod_mono_server_global
MonoTargetFramework&#34; 4.0&#34;
我的网站在httpd.conf中配置:
Alias /boacommander_simple "/var/www/html/boacommander_simple"
MonoApplications "/boacommander_simple:/var/www/html/boacommander_simple"
<Location /boacommander_simple>
SetHandler mono
</Location>
之前的单声道版本是3.2.8和mod_mono 2.10。使用框架4.0。
谢谢你,如果你能提供一些建议。
关于此的更多信息:
运行xsp4将在控制台上生成以下输出:
# xsp4
Missing method System.Configuration.IConfigurationSectionHandler::Create(object,object,XmlNode) in assembly /usr/lib/mono/4.0/System.dll, referenced in assembly /usr/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 <filename unknown>:0
at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <filename unknown>:0
at Mono.WebServer.XSP.Server.get_AppSettings () [0x00000] in <filename unknown>:0
at Mono.WebServer.XSP.Server+ApplicationSettings..ctor () [0x00000] in <filename unknown>:0
xsp4
Listening on address: 0.0.0.0
Root directory: /
Listening on port: 8080 (non-secure)
Hit Return to stop the server.
Missing method System.Configuration.ConfigurationProperty::.ctor(string,Type,object,TypeConverter,ConfigurationValidatorBase,ConfigurationPropertyOptions) in assembly /usr/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll, referenced in assembly /usr/lib/mono/4.0/System.Web.dll
Exception during TraceManager initialization:
System.TypeInitializationException: An exception was thrown by the type initializer for System.Web.Configuration.TraceSection ---> System.MissingMethodException: Method not found: 'System.Configuration.ConfigurationProperty..ctor'.
--- End of inner exception stack trace ---
at System.Web.TraceManager..ctor () [0x00000] in <filename unknown>:0
有一些类似的问题,但没有答案导致问题或如何解决问题。
我将mono更新为3.4.1并重新安装了mod_mono和xsp。我仍然会遇到错误,但这些错误必须与我原来的问题无关。我将这个打开,以防其他人使用我所做的相同版本得到类似的结果。我升级了我的单声道并遇到了新问题,我会在另一篇文章中询问这些问题。