I am having issues with NHibernate on Mono (Ubuntu server 13.04)
Mono version:
Mono JIT compiler version 3.2.1 ((no/f3f789e Wed Aug 21 17:40:25 UTC 2013)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
I get this exception:
System.InvalidProgramException
Invalid IL code in System.Data.Common.DbProviderFactories:GetFactory (string): method body is empty.
Details:
Non-web exception. Exception origin (name of application or object): NHibernate.
Exception Stack Trace:
at NHibernate.Driver.ReflectionBasedDriver..ctor (System.String providerInvariantName, System.String driverAssemblyName, System.String connectionTypeName, System.String commandTypeName) [0x00000] in <filename unknown>:0
at NHibernate.Driver.NpgsqlDriver..ctor () [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
The code where I get the exception looks like this:
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
//NpgsqlEventLog.Level = LogLevel.Debug;
//NpgsqlEventLog.LogName = "NpgsqlTests.LogFile";
SessionFactory = Fluently.Configure().Database(FluentNHibernate.Cfg.Db.PostgreSQLConfiguration.Standard.
ConnectionString(c =>
c.Host("localhost")
.Database("newtest")
.Username("postgres")
.Password("******")
.Port(5432)
)).Mappings(m =>
m.FluentMappings.AddFromAssemblyOf<Entity>())
.ExposeConfiguration(c => c.SetProperty("current_session_context_class", "web"))
.BuildSessionFactory();
}
I solved my issue by removing unwanted references in Web.Config file. There still was an configuration section for Entity Framework, even if I had removed it with NuGet.
When all these unwanted dll references were removed in Web.Config, the project ran as it should in mono environment, so the errors I mentioned in my initial entry is a bit misleading as the issues had nothing to do with NHibernate.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다