Question

I am attempting to run my selfhosted servicestack console app using mono in ubuntu.

I am only coming up against this problem when trying to run with mono on my ubuntu server. The application works fine in a windows environment.

When I try to start my app with mono appname.exe I get the following error:

System.TypeLoadException: Could not load type 'Api.Database.MySqlConnection' from assembly 'Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
at (wrapper managed-to-native) System.Type:type_is_assignable_from   (System.Type,System.Type)
at System.Type.IsAssignableFrom (System.Type c) [0x00000] in <filename unknown>:0
at ServiceStack.ServiceHost.ServiceController.RegisterNService (ITypeFactory     serviceFactoryFn, System.Type serviceType) [0x00000] in <filename unknown>:0
at ServiceStack.ServiceHost.ServiceController.Register (ITypeFactory serviceFactoryFn)  [0x00000] in <filename unknown>:0
at ServiceStack.ServiceHost.ServiceManager.Init () [0x00000] in <filename unknown>:0
at ServiceStack.WebHost.Endpoints.Support.HttpListenerBase.Init () [0x00000] in <filename unknown>:0
at UniBooks_Api_Runner.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

Mono works fine for me using other apps on this box, so im not so confident its a mono issue - perhaps a mono clash with some of the service stack stuff though?

The particular class the error references at the top uses the following assemblies:

using System;
using System.Data;
using MySql.Data.MySqlClient;

The class also implements System.Data.IDbConnection and im also using .net framework 4.5

Id like to point out that I have adapted the console app for linux/ubuntu by reading this answer and by following this tutorial and I am referencing the Mono.Unix assembly so I dont think there is an issue with the way ive set the app up to be self hosted.

Has anyone came up against this issue or this type of issue before? Can you help me understand the problem and perhaps where to look for a solution.

Thanks

Était-ce utile?

La solution

Try setting MONO_LOG_LEVEL and optionally MONO_LOG_MASK such as: MONO_LOG_LEVEL=debug MONO_LOG_MASK=asm mono --debug appname.exe and see whether the output helps troubleshoot the problem.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top