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.
Related
Anyone managed to get the Perforce p4api.net work with Linux ?
My projects build correctly on Mono 2.8.4, the dlls (p4bridge.dll and p4api.net.dll are in bin/Debug, but whenever I try to execute it, I get this exception :
Unhandled Exception: System.DllNotFoundException: p4bridge.dll
at (wrapper managed-to-native) Perforce.P4.P4Bridge:ConnectA (string,string,string,string,Perforce.P4.P4CallBacks/LogMessageDelegate)
at Perforce.P4.P4Server..ctor (System.String server, System.String user, System.String pass, System.String ws_client) [0x00000] in <filename unknown>:0
at Perforce.P4.Connection.Connect (Perforce.P4.Options options) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: p4bridge.dll
at (wrapper managed-to-native) Perforce.P4.P4Bridge:ConnectA (string,string,string,string,Perforce.P4.P4CallBacks/LogMessageDelegate)
at Perforce.P4.P4Server..ctor (System.String server, System.String user, System.String pass, System.String ws_client) [0x00000] in <filename unknown>:0
at Perforce.P4.Connection.Connect (Perforce.P4.Options options) [0x00000] in <filename unknown>:0
The API is the latest (2013.3) with MonoDevelop 2.8.4 as mentionned, and all mono RPMs are up to date.
Again, as mentionned, both Perforce DLLs are copied into bin/Debug, the project compiles properly, and it does find the p4api.net.dll (as the exception shows), but not the p4bridge.dll. I'm starting to suspect that p4bridge.dll is not a managed .NET library.
Any ideas ?
--JFG
p4bridge is not a managed library so you would need to build it for each platform that you want to run on.
If you want to use P4NET.API in Mono, you could take a look at the P4Connect source code. That project includes a version of the P4NET.API library which works in OSX under Mono. They have yet to integrate that code back into the main P4NET.API library though.
I am using VS2012 RC and created a MVC4 app in .NET 4.0 mode. I use Ninject + Ninject.MVC3 as a DI container. It works on my development machine on Windows and on another machine with .NET 4.0 installed, but when I deploy it on a Linux server with Mono 3.0.2, XSP and fastcgi + lighttpd I just get a Ninject related error message:
System.InvalidOperationException
Sequence contains no matching element
at System.Linq.Enumerable.Single[DataAnnotationsModelValidatorProvider] (IEnumerable`1 source, System.Func`2 predicate, Fallback fallback) [0x00000] in <filename unknown>:0
at System.Linq.Enumerable.Single[DataAnnotationsModelValidatorProvider] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
at Ninject.Web.Mvc.NinjectMvcHttpApplicationPlugin.Start () [0x00000] in <filename unknown>:0
at Ninject.Web.Common.Bootstrapper.<Initialize>b__0 (INinjectHttpApplicationPlugin c) [0x00000] in <filename unknown>:0
at Ninject.Infrastructure.Language.ExtensionsForIEnumerableOfT.Map[INinjectHttpApplicationPlugin] (IEnumerable`1 series, System.Action`1 action) [0x00000] in <filename unknown>:0
at Ninject.Web.Common.Bootstrapper.Initialize (System.Func`1 createKernelCallback) [0x00000] in <filename unknown>:0
at MvcApplication1.App_Start.NinjectWebCommon.Start () [0x00000] in <filename unknown>:0
at MvcApplication1.MvcApplication.Application_Start () [0x00000] in <filename unknown>:0
To clarify: I had to manually call the Start and Stop methods of the generated NinjectWebCommon class, because the [assembly: WebActivator.PreApplicationStartMethod...] attribute gets ignored (I first got error messages regarding missing default constructors, which are normal for a DI-ed controller)
I also tried subclassing NinjectHttpApplication, but I got the same error.
Any help here?
DI containers are kind of flaky in Mono in my experience. If you don't have time to dig up deeper and fix what possibly seems to be a Mono bug, I would try a different DI container.
I've designed an application in which the user must register himself. For this I've used a Web Service, and the application running in the Unity Editor on Mac OS X, or Windows makes the request without errors.
If I build the application as a Windows executable it also works, but when I build the application for Mac OS X it no longer works (outside the Editor). The request does not work properly.
In the project I've created Plugins folder and introduced both System.Web and System.Web.Services DLLs.
Api Compability Level in Player Settings is NET 2.0.
When I try to run the Mac OS X build I get this error message in the Log:
at System.Net.WebRequest.GetCreator (System.String prefix) [0x00000] in <filename unknown>:0
at System.Net.WebRequest.Create (System.Uri requestUri) [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest (System.Uri uri) [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest (System.Uri uri) [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest (System.Uri uri) [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.SoapHttpClientProtocol.GetRequestForMessage (System.Uri uri, System.Web.Services.Protocols.SoapClientMessage message) [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in <filename unknown>:0
at BGWebServiceService.login (.LoginRequestBean bean) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) BGWebServiceService:login (LoginRequestBean)
at ClientObject.loginAsyncRequest () [0x00000] in <filename unknown>:0
I've looked many forums and searched the web and I can't find the answer. I don´t know if it´s necessary to add any other folder, put the DLLs on some other place or do something else in the project.
Any help would be very appreciated.
Thank you.
I have found how to make it work.
Only, we have to add /Applications/Unity/Unity.app/Contents/Frameworks/Mono folder into our Framework´s app folder.
I'm running a pre-built application using Mono, and it runs alongside a DLL in the same directory (mysql.data.dll). When I run the application with Mono, I get this error:
Could not load type 'Snowlight.Storage.SqlDatabaseClient' from assembly 'Snowlight, Version=0.1.0.35857, Culture=neutral, PublicKeyToken=null'.
at System.Collections.Generic.Dictionary`2[System.Int32,Snowlight.Storage.SqlDatabaseClient].Init (Int32 capacity, IEqualityComparer`1 hcp) [0x00000] in <filename unknown>:0
at System.Collections.Generic.Dictionary`2[System.Int32,Snowlight.Storage.SqlDatabaseClient]..ctor () [0x00000] in <filename unknown>:0
at Snowlight.Storage.SqlDatabaseManager.Initialize () [0x00000] in <filename unknown>:0
at Snowlight.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
Judging by <filename unknown>, I am assuming this happens because the DLL it requires isn't found, so how would I get the application to recognize it and use it?
Try running it like this from a terminal:
export MONO_LOG_LEVEL=debug
export MONO_LOG_MASK=asm
mono --debug yourapp.exe
Now every assembly lookup will be printed to the terminal, so you'll be able to find out what's being looked for where.
When I try to create a new solution in MonoDevelop 2.8.5 in Ubuntu 11.04 x64, it shows me:
System.ArgumentNullException: Argument cannot be null.
Parameter name: path1
at System.IO.Path.Combine (System.String path1, System.String path2) [0x00000] in <filename unknown>:0
at MonoDevelop.Core.FilePath.Combine (System.String[] paths) [0x00000] in <filename unknown>:0
at MonoDevelop.Projects.ProjectCreateInformation.get_BinPath () [0x00000] in <filename unknown>:0
at MonoDevelop.Projects.DotNetProject..ctor (System.String languageName, MonoDevelop.Projects.ProjectCreateInformation projectCreateInfo, System.Xml.XmlElement projectOptions) [0x00000] in <filename unknown>:0
at MonoDevelop.Projects.DotNetAssemblyProject..ctor (System.String languageName, MonoDevelop.Projects.ProjectCreateInformation projectCreateInfo, System.Xml.XmlElement projectOptions) [0x00000] in <filename unknown>:0
at MonoDevelop.Projects.DotNetProjectBinding.CreateProject (System.String languageName, MonoDevelop.Projects.ProjectCreateInformation info, System.Xml.XmlElement projectOptions) [0x00000] in <filename unknown>:0
at MonoDevelop.Projects.DotNetProjectBinding.CreateProject (MonoDevelop.Projects.ProjectCreateInformation info, System.Xml.XmlElement projectOptions) [0x00000] in <filename unknown>:0
at MonoDevelop.Projects.ProjectService.CreateProject (System.String type, MonoDevelop.Projects.ProjectCreateInformation info, System.Xml.XmlElement projectOptions) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.Templates.ProjectDescriptor.CreateItem (MonoDevelop.Projects.ProjectCreateInformation projectCreateInformation, System.String defaultLanguage) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.Templates.ProjectTemplate.HasItemFeatures (MonoDevelop.Projects.SolutionFolder parentFolder, MonoDevelop.Projects.ProjectCreateInformation cinfo) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.Projects.NewProjectDialog.SelectedIndexChange (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0
I strace'd it and saw repeated failed accesses to files like:
/usr/lib/mono/gac/gtk-sharp/2.12.0.0__35e10195dab3c99f/libgtk-x11-2.0.so.0.la
so I'm assuming that's the cause of the problem.
However, I've installed (and re-installed) anything GTK#-related that I could think of... and the error still occurs.
Does anyone know how to fix it?
A get it resolved by setting permission in directory and creating the directory.
Try the following:
1) Click on Start new solution.
2) Before select the solution type, select a location.
3) Select the solution type.
4) Select name.
It works for me in Ubuntu 10.04.
I just released a set of packages for ubuntu 11.10, they might also work on 11.04.
Add the following to your /etc/apt/sources.list:-
deb http://void.printf.net/~bredroll/pmono ./
Simply install everything like so:-
$ sudo apt-get update $ sudo apt-get install pmono-scripts pmono-monodevelop
This is a parallel mono installation so won't conflict or interact with the existing mono.
This only includes MD 2.8.2 but it seems to work well for me. When I find more time I'll update MD to 2.8.5