我有一个工作的mvc4项目在Apache中用mod_mono运行了很长一段时间。 我暂时没有触及Apache,无论出于何种原因,我决定重启它。网站突然停止了工作。
我在浏览器中收到错误503。 重新启动Apache时,会立即在Apache的error.log中记录以下内容。此外,每当我输入网站的网址时:
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies.
File name: 'Mono.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'
at (wrapper xdomain-invoke) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate)
at (wrapper remoting-invoke-with-check) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate)
at System.Web.Hosting.ApplicationHost.CreateApplicationHost (System.Type hostType, System.String virtualDir, System.String physicalDir) <0x41bbbd60 + 0x00b2d> in <filename unknown>:0
at Mono.WebServer.VPathToHost.CreateHost (Mono.WebServer.ApplicationServer server, Mono.WebServer.WebSource webSource) <0x41bbaf70 + 0x000b7> in <filename unknown>:0
at Mono.WebServer.Apache.Server.RealMain (System.String[] args, Boolean root, IApplicationHost ext_apphost, Boolean v_quiet) <0x41b5f3e0 + 0x006af> in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.WebServer.Apache.Server:RealMain (string[],bool,Mono.WebServer.IApplicationHost,bool)
at Mono.WebServer.Apache.Server.Main (System.String[] args) <0x41b5ed70 + 0x000e3> in <filename unknown>:0
.
.
.
[:error] [pid 6850] Failed to connect to mod-mono-server after several attempts to spawn the process.
我的虚拟主机文件:
<VirtualHost *:80>
ServerName fta.domain.com
ServerAlias fta.domain.com
ServerAdmin web-admin@Servername
DocumentRoot /home/username/public_html/FifaTournamentApp
# MonoServerPath can be changed to specify which version of ASP.NET is hosted
# mod-mono-server1 = ASP.NET 1.1 / mod-mono-server2 = ASP.NET 2.0
# For SUSE Linux Enterprise Mono Extension, uncomment the line below:
# MonoServerPath Username "/opt/novell/mono/bin/mod-mono-server2"
# For Mono on openSUSE, uncomment the line below instead:
MonoServerPath Username "/usr/bin/mod-mono-server4"
# To obtain line numbers in stack traces you need to do two things:
# 1) Enable Debug code generation in your page by using the Debug="true"
# page directive, or by setting <compilation debug="true" /> in the
# application's Web.config
# 2) Uncomment the MonoDebug true directive below to enable mod_mono debugging
#MonoDebug Username true
# The MONO_IOMAP environment variable can be configured to provide platform abstraction
# for file access in Linux. Valid values for MONO_IOMAP are:
# case
# drive
# all
# Uncomment the line below to alter file access behavior for the configured application
MonoSetEnv Username MONO_IOMAP=all
#
# Additional environtment variables can be set for this server instance using
# the MonoSetEnv directive. MonoSetEnv takes a string of 'name=value' pairs
# separated by semicolons. For instance, to enable platform abstraction *and*
# use Mono's old regular expression interpreter (which is slower, but has a
# shorter setup time), uncomment the line below instead:
# MonoSetEnv Username MONO_IOMAP=all;MONO_OLD_RX=1
MonoApplications Username "/:/home/username/public_html/FifaTournamentApp"
<Location "/">
Allow from all
Order allow,deny
MonoSetServerAlias Username
SetHandler mono
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
</Location>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
</IfModule>
在终端中输入mod-mono-server4似乎工作正常:
mod-mono-server4
Listening on: /tmp/mod_mono_server
Root directory: /home/supporthjalpen/public_html/
Hit Return to stop the server.
非常感谢您的帮助!