NHibernate on Mono running ASP.NET MVC 3 web application

Gunnar

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();
    }
Gunnar

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] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

ASP.NET MVC의 CreateCriteria 및 이전 NHibernate

분류에서Dev

Mono ASP.Net MVC EntityFramework 예외

분류에서Dev

How to programmatically modify web.config in ASP.NET MVC and C# application?

분류에서Dev

My asp.net mvc web application will always check if the request is authnticated or not

분류에서Dev

ASP.NET MVC 및 WEB API

분류에서Dev

Random number in URL of ASP .NET web application

분류에서Dev

WCF between ASP MVC 5 web application and winforms application

분류에서Dev

FormsAuthentication on mono/ASP.NET?

분류에서Dev

nHibernate 기준 (Asp.Net MVC4)의 연관이 아님

분류에서Dev

Asp.Net MVC Model Binding to a property type System.Uri got issues with Mono

분류에서Dev

Using memorycache in asp.net mvc application it gets created everytime

분류에서Dev

.subscribe is not working in my ASP.NET MVC application

분류에서Dev

ASP.NET MVC web API request limits

분류에서Dev

ASP.NET MVC 5 and WEB API use Same Authentication

분류에서Dev

Nhibernate의 ASP.NET 오류

분류에서Dev

ASP.Net Application Crashes because of Web Service

분류에서Dev

Asp.net MVC4에서 NHibernate를 사용하여 개체 업데이트

분류에서Dev

ASP.NET on Mono 4.0 - Objects Not Found

분류에서Dev

Session item always null in asp.net mvc3

분류에서Dev

ASP.NET MVC 3 인덱싱 varchar 열

분류에서Dev

ASP.NET Web Forms에 대한 Mono의 지원은 어떻게 될까요?

분류에서Dev

Asp.net core 3 Web Api post request not working

분류에서Dev

ASP.NET MVC 및 모바일 장치에서 ASP.NET Web API 사용

분류에서Dev

ASP .NET MVC 애플리케이션에서 NHibernate 이벤트 리스너로 데이터 전달

분류에서Dev

why my HttpContext.Application variable cannot be access through different Actions in ASP.NET MVC

분류에서Dev

Is it possible to self-host the asp.net mvc application without the use of IIS?

분류에서Dev

href의 Mono ASP.NET MVC 물결표로 인해 System.NotImplementedException이 발생합니다.

분류에서Dev

ASP.Net MVC and Web Forms applications using same domain name, but code is kept in separate solutions

분류에서Dev

의존성 주입 및 ASP.net MVC 5 / Web API 2

Related 관련 기사

  1. 1

    ASP.NET MVC의 CreateCriteria 및 이전 NHibernate

  2. 2

    Mono ASP.Net MVC EntityFramework 예외

  3. 3

    How to programmatically modify web.config in ASP.NET MVC and C# application?

  4. 4

    My asp.net mvc web application will always check if the request is authnticated or not

  5. 5

    ASP.NET MVC 및 WEB API

  6. 6

    Random number in URL of ASP .NET web application

  7. 7

    WCF between ASP MVC 5 web application and winforms application

  8. 8

    FormsAuthentication on mono/ASP.NET?

  9. 9

    nHibernate 기준 (Asp.Net MVC4)의 연관이 아님

  10. 10

    Asp.Net MVC Model Binding to a property type System.Uri got issues with Mono

  11. 11

    Using memorycache in asp.net mvc application it gets created everytime

  12. 12

    .subscribe is not working in my ASP.NET MVC application

  13. 13

    ASP.NET MVC web API request limits

  14. 14

    ASP.NET MVC 5 and WEB API use Same Authentication

  15. 15

    Nhibernate의 ASP.NET 오류

  16. 16

    ASP.Net Application Crashes because of Web Service

  17. 17

    Asp.net MVC4에서 NHibernate를 사용하여 개체 업데이트

  18. 18

    ASP.NET on Mono 4.0 - Objects Not Found

  19. 19

    Session item always null in asp.net mvc3

  20. 20

    ASP.NET MVC 3 인덱싱 varchar 열

  21. 21

    ASP.NET Web Forms에 대한 Mono의 지원은 어떻게 될까요?

  22. 22

    Asp.net core 3 Web Api post request not working

  23. 23

    ASP.NET MVC 및 모바일 장치에서 ASP.NET Web API 사용

  24. 24

    ASP .NET MVC 애플리케이션에서 NHibernate 이벤트 리스너로 데이터 전달

  25. 25

    why my HttpContext.Application variable cannot be access through different Actions in ASP.NET MVC

  26. 26

    Is it possible to self-host the asp.net mvc application without the use of IIS?

  27. 27

    href의 Mono ASP.NET MVC 물결표로 인해 System.NotImplementedException이 발생합니다.

  28. 28

    ASP.Net MVC and Web Forms applications using same domain name, but code is kept in separate solutions

  29. 29

    의존성 주입 및 ASP.net MVC 5 / Web API 2

뜨겁다태그

보관