I just set up mod-mono on my CentOS box and configured Apache to serve .aspx pages, but it's throwing errors whenever a page is served. The error is:
System.IO.FileNotFoundException: Could not load file or assembly 'mod-mono-server2, Version=2.10.2.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. The system cannot find the file specified.
File name: 'mod-mono-server2, Version=2.10.2.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'
at (wrapper xdomain-invoke) System.AppDomain:CreateInstanceAndUnwrap (string,string)
at (wrapper remoting-invoke-with-check) System.AppDomain:CreateInstanceAndUnwrap (string,string)
at System.Web.Hosting.ApplicationHost.CreateApplicationHost (System.Type hostType, System.String virtualDir, System.String physicalDir) [0x00000] in <filename unknown>:0
at Mono.WebServer.VPathToHost.CreateHost (Mono.WebServer.ApplicationServer server, Mono.WebServer.WebSource webSource) [0x00000] in <filename unknown>:0
at Mono.WebServer.ApplicationServer.GetApplicationForPath (System.String vhost, Int32 port, System.String path, Boolean defaultToRoot) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.WebServer.ApplicationServer:GetApplicationForPath (string,int,string,bool)
at Mono.WebServer.ModMonoWorker.GetOrCreateApplication (System.String vhost, Int32 port, System.String filepath, System.String virt) [0x00000] in <filename unknown>:0
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
My mono prefix is /opt/mono
. If I manually run /opt/mono/bin/mod-mono-server2
it throws the same error (how can it not find itself?). Any idea on how to resolve this? It should be noted that I have a parallel mono installation in /usr/local
, but /opt/mono
comes first in PATH
.
EDIT: I ran /opt/mono/bin/mod-mono-server2
with verbose logging and I can see AOT attempting to load libraries and failing. Here is a paste of the log: http://hastebin.com/cijubibefe.log
Many of these libraries do not have shared object files with them. For example, /opt/mono/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll
exists (along with System.dll.mdb
) but /opt/mono/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll.so
does not exist.
EDIT2: Solved
I just figured it out. Somehow when I was building Mono, XSP, and mod-mono, my prefix didn't get obeyed for part of the build sequence and the launch scripts for executables such as mod-mono-server2
were running with /usr/local/bin/mono
instead of /opt/mono/bin/mono
, which obviously didn't have mod-mono-server2 in GAC. Editing all the launch scripts to use /opt/mono/bin/mono
fixed the issue.