Search code examples
monoasp.net-mvc-4mod-monoxsp4

How to successfully host ASP.NET MVC4 RC on Mono 2.10.8


I'm trying to host a ASP.NET MVC4 RC project on top of Mono 2.10.8.1. I'm getting the following exception when I access the app for the first time:

Missing method System.Web.Security.FormsAuthentication::get_IsEnabled() in assembly /usr/lib/mono/gac/System.Web/4.0.0.0__b03f5f7f11d50a3a/System.Web.dll, referenced in assembly /tmp/root-temp-aspnet-0/eaee30a1/assembly/shadow/5cf10065/40974e7d_1c664e18_00000001/System.Web.Http.WebHost.dll

According to http://www.mono-project.com/Compatibility this should be implemented in Mono 2.10.8. Microsoft lists the property as .NET Framework 4.0: http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.isenabled.aspx

Is there a work-around of some kind, or is it just not possible to host MVC4 on Mono at this time?

I should note that I'm getting this problem both when using XSP4 and mod_mono on Apache2.

Mono version is the following:

Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-1~dhx1~lucid1)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  x86
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)

Solution

  • TL/DR: Running MVC4 under Mono is still not recommended, run MVC3 instead.

    Long story: at the time Mono 2.10.x was released, Microsoft had not fully released the ASP.NET stack as open source (Razor was one of the components that was still closed source).

    Recently Microsoft finally opensourced the full stack, and Mono has included it in their tree, however this has happened only in master branch (and only preview versions of Mono 2.11.x include it). Besides, the async APIs are not yet implemented in Mono (and MVC4 depends on them) so then the best bet for you is use MVC3 for now, with Mono 3.0.1 version.

    Even longer story: http://tirania.org/blog/archive/2012/Mar-28.html