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

Rafael Teixeira monoman at gmail.com
Wed Oct 24 11:35:35 UTC 2012


Hi Daniel,

Well at
https://github.com/mono/mono/blob/master/mcs/class/System.Net.Http/System.Net.Http/HttpMessageInvoker.cs
one
can see that such class is part of Mono and stable for at least 5 months,
so it surely should be found in Mono 3.0 but from your log it seems that
your server is loading a copy found on your bin directory, that may be
outdated...

*Mono: Assembly Loader probing location:
'/var/www/WebApiTest/bin/System.Net.Http.dll'.
Mono: Assembly Loader shadow-copied assembly to:
'/tmp/root-temp-aspnet-0/2956977a/assembly/shadow/ebec392e/785c7991_93b040bf_00000001/System.Net.Http.dll'.
*
So please get rid of your copy of System.Net.Http.dll, and it should work.

In the other hand surely IHostBufferPolicySelector is missing from
https://github.com/mono/mono/blob/master/mcs/class/System.Web.Http/System.Web.Http.dll.sources.
Maybe this is newer than the open sourced files from Microsoft being used
in that part of Mono.

Please open an issue for this second problem, probably the aspnetstack
needs to be refreshed, although this may appear only in the 4.5 profile,
I'm not sure what are the .NET platform requirements for ASP.NET Web API.

Fun,

Rafael "Monoman" Teixeira
---------------------------------------
"The most exciting phrase to hear in science, the one that heralds new
discoveries, is not 'Eureka!' (I found it!) but 'That's funny ...'"
Isaac Asimov
US science fiction novelist & scholar (1920 - 1992)


On Wed, Oct 24, 2012 at 2:03 AM, Daniel Lo Nigro <lists at dan.cx> wrote:
>
> Just rediscovered the MONO_LOG_LEVEL="debug" environment variable. Here's
the log from my app: http://sprunge.us/eXOV. I think these might be
related, but of course I could be totally wrong:
> Mono: The class System.Web.Http.Hosting.IHostBufferPolicySelector could
not be loaded, used in System.Web.Http, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35
> Mono: The class System.Net.Http.HttpMessageInvoker could not be loaded,
used in System.Net.Http, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a
>
> Thoughts?
>
>
>
> On Wed, Oct 24, 2012 at 2:23 PM, Daniel Lo Nigro <lists at dan.cx> wrote:
>>
>> 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!
>
>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20121024/cd1828bc/attachment.html>


More information about the Mono-devel-list mailing list