Does ASP.NET Web API (beta) work with the last mono (stable)?

I am trying to get a new beta version of ASP.NET web API (VS 2010 default web API project) running on Ubuntu 10.04 with Mono 2.10.8.1. Unfortunately, I have failed in all my attempts so far. The most β€œsubstantial” exception I received is the following:

System.TypeLoadException: Could not load type 'RestTest.Controllers.ValuesController' from assembly 'RestTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. at (wrapper managed-to-native) System.Type:type_is_assignable_from (System.Type,System.Type) at System.Type.IsAssignableFrom (System.Type c) [0x00000] in <filename unknown>:0 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 () [0x00000] in <filename unknown>:0 at System.Collections.Generic.List`1[System.Type].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0 at System.Collections.Generic.List`1[System.Type]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0 at System.Linq.Enumerable.ToList[Type] (IEnumerable`1 source) [0x00000] in <filename unknown>:0 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 RestTest.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) [0x00000] in <filename unknown>:0 

I do not think that something is wrong with the actual ValuesController class. This is basically an empty class. Instead, there is a problem with the base class called "ApiController", which is distributed with the NuGet package "AspNetWebApi.Core.4.0.20126.16343" (System.Web.Http.dll). I check all the new libraries for "MoMA" (Mono Migration Analyzer), and the results are that a few more methods have not yet been implemented.

So my questions are: does anyone know when the ASP.NET Web API can be used with Mono? Is there a way to make it work anyway (possibly using Microsoft libs instead of Mono)?

Addendum:

A quick note for those trying to run a regular MVC4 project on mono with the above configuration. I ran into small problems because one method - AllowOnlyFipsAlgorithms () - has not yet been implemented. It was called somewhere in "System.Web.Optimization" using "CreateHashAlgorithm", and in order to run my project, I had to remove all links to this library. Yes, now you have to do without all the new and neat CSS / Javascript layout features, but at least you get your site.

+6
source share
1 answer

It is possible, but it can be pain. Consider servicestack.net , which works both in mono and in windows.

+1
source

Source: https://habr.com/ru/post/910412/


All Articles