[Mono-dev] ASP.NET Web API on Mono 3.0 (Could not load type 'System.Web.Http.WebHost.HttpControllerHandler')

Daniel Lo Nigro lists at dan.cx
Wed Oct 24 03:23:08 UTC 2012


I'm trying to get ASP.NET WebApi working on Mono 3.0, and am getting
the following error:

System.TypeLoadException: Could not load type
'System.Web.Http.WebHost.HttpControllerHandler' from assembly
'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.
  at (wrapper managed-to-native) System.Type:type_is_assignable_from
(System.Type,System.Type)
  at System.Type.IsAssignableFrom (System.Type c) [0x00096] in
/usr/local/src/mono-3.0.0/mcs/class/corlib/System/Type.cs:902
  at System.Web.Mvc.AreaRegistration.IsAreaRegistrationType
(System.Type type) [0x00000] in <filename unknown>:0
  at System.Web.Mvc.TypeCacheUtil+<>c__DisplayClass1.<FilterTypesInAssemblies>b__0
(System.Type type) [0x00000] in <filename unknown>:0
  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator35`1[System.Type].MoveNext
() [0x00059] in
/usr/local/src/mono-3.0.0/mcs/class/System.Core/System.Linq/Enumerable.cs:3030
  at System.Collections.Generic.List`1[System.Type].AddEnumerable
(IEnumerable`1 enumerable) [0x00013] in
/usr/local/src/mono-3.0.0/mcs/class/corlib/System.Collections.Generic/List.cs:134
  at System.Collections.Generic.List`1[System.Type]..ctor
(IEnumerable`1 collection) [0x0002f] in
/usr/local/src/mono-3.0.0/mcs/class/corlib/System.Collections.Generic/List.cs:69
  at System.Linq.Enumerable.ToList[Type] (IEnumerable`1 source)
[0x00006] in /usr/local/src/mono-3.0.0/mcs/class/System.Core/System.Linq/Enumerable.cs:2867
  at System.Web.Mvc.TypeCacheUtil.GetFilteredTypesFromAssemblies
(System.String cacheName, System.Predicate`1 predicate, IBuildManager
buildManager) [0x00000] in <filename unknown>:0
  at System.Web.Mvc.AreaRegistration.RegisterAllAreas
(System.Web.Routing.RouteCollection routes, IBuildManager
buildManager, System.Object state) [0x00000] in <filename unknown>:0
  at System.Web.Mvc.AreaRegistration.RegisterAllAreas (System.Object
state) [0x00000] in <filename unknown>:0
  at System.Web.Mvc.AreaRegistration.RegisterAllAreas () [0x00000] in
<filename unknown>:0
  at Daniel15.WebApiTest.WebApiApplication.Application_Start ()
[0x00000] in <filename unknown>:0
  at (wrapper managed-to-native)
System.Reflection.MonoMethod:InternalInvoke
(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x000d5] in /usr/local/src/mono-3.0.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:229

Followed by this error:
System.TypeLoadException:
A type load exception has occurred.
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or
object): Daniel15.WebApiTest.

Are there additional debug flags I can use to determine what's causing
this and why it's unable to load the type? I'm using Mono 3.0
(compiled from source) and xsp/fastcgi-mono-server4 (latest Git
version)

Thanks in advance!


More information about the Mono-devel-list mailing list