Search code examples
apacheasp.net-mvc-4ubuntumonoxsp

FormsAuthentication of ASP.NET app running on Mono


I have an ASP.NET MVC4 web application which was developed using Visual Studio in Windows. I am trying to deploy it to an Apache server running on Ubuntu. I am settling for getting it working on xsp for time being, since that seems simpler to start.

The latest in a long series of errors is this:

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/username-temp-aspnet-0/e475125c/assembly/shadow/5cf10065/81ba6702_dd4b6767_00000001/System.Web.Http.WebHost.dll

I have deleted the < authentication mode="..">... tags from the web.config file, so I'm not sure why anything is trying to call FormsAuthentication. The error appears to be coming from the mono .dlls.

What is causing this error, and what do I need to do to fix it?


Solution

  • This - and a host of related error messages - were because I had both Mono 2 and Mono 4 installed, and Mono 2 does not support MVC4, but for some reason was the default. I removed and reinstalled Mono, and this has fixed this particular problem.

    Could not load type 'System.Web.Http.WebHost.HttpControllerHandler' from assembly 'System.Web.Http.WebHost'
    Could not load type 'System.Web.Http.AcceptVerbsAttribute' from assembly 'System.Web.Http'
    Could not load type 'System.Web.Http.Controllers.HttpActionContext' from assembly 'System.Web.Http'     
    Could not load type 'System.Web.Http.HttpOptionsAttribute' from assembly 'System.Web.Http' 
    Could not load type 'System.Web.Http.HttpHeadAttribute' from assembly 'System.Web.Http'
    Could not load type 'System.Web.Http.HttpPatchAttribute' from assembly 'System.Web.Http'
    

    Update:

    You will also get this problem if there is a mismatch between the version of MVC (or System.Web.whatever) specified in your web.config, and the dlls which you are using.