Mod_Mono ASP.NET MVC 4 Deployment Issue

485 Views Asked by At

I have an ASP.NET MVC 4 application which I have developed using Xamarin Studio on OS X. I am deploying into a Docker container running Ubuntu Server (latest version) with mono 3.2.8 installed along with mod_mono and apache.

I've successfully configured the website to run for under mono-server-4 as it is a .NET 4.0 website. However, I am getting the following error:

[System.TypeLoadException]: Could not load type 'System.Web.Routing.RouteCollection' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
      at (wrapper managed-to-native) System.Reflection.MonoMethodInfo:get_method_info (intptr,System.Reflection.MonoMethodInfo&)
      at System.Reflection.MonoMethodInfo.GetMethodInfo (IntPtr handle) [0x00000] in <filename unknown>:0
      at System.Reflection.MonoMethodInfo.GetDeclaringType (IntPtr handle) [0x00000] in <filename unknown>:0
      at System.Reflection.MonoMethod.get_DeclaringType () [0x00000] in <filename unknown>:0
      at System.Web.HttpApplicationFactory.GetApplicationTypeEvents (System.Type type) [0x00000] in <filename unknown>:0
      at System.Web.HttpApplicationFactory.GetApplicationTypeEvents (System.Web.HttpApplication app) [0x00000] in <filename unknown>:0
      at System.Web.HttpApplicationFactory.FireEvent (System.String method_name, System.Object target, System.Object[] args) [0x00000] in <filename unknown>:0
      at System.Web.HttpApplicationFactory.FireOnAppStart (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
      at System.Web.HttpApplicationFactory.GetApplication (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
      at System.Web.HttpRuntime.Process (System.Web.HttpWorkerRequest req) [0x00000] in <filename unknown>:0

I'm not sure why I'm getting this error as I have the mono-complete installed on the target server and the application runs correctly locally. Any help is much appreciated!

Edit: After several requests (4 or 5) I seem to be getting a 404 from the same URL. Not sure if this is related or not...

2

There are 2 best solutions below

0
On BEST ANSWER

I finally solved the issue. It seems I accidentally misspelled the name of my application when setting the MonoServerPath directive in the apache configuration file.

0
On

I just ran into this same problem trying to run an MVC application on mono using XSP2. The solution for me was to install mono-xsp4 and run it using xsp4 instead.