Could not load type 'System.Web.Http.WebHost.H

2019-01-15 19:02发布

I'm getting this error when trying to access Web API controller, accessing via 127.0.0.1/api/myController/1

Could not load type 'System.Web.Http.WebHost.HttpControllerHandler' from assembly 'System.Web.Http.WebHost, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Description: HTTP 500.Error processing request.

Details: Non-web exception. Exception origin (name of application or object): System.Web.Http.WebHost.

Why is this happening? I see that it exists in System.Web.Http.WebHost.

1条回答
祖国的老花朵
2楼-- · 2019-01-15 20:00

The error was due to the use of latest assemblies via NuGet. It turns out that, currently, Mono isn't completely compatible with WebAPI v5.1.

I replaced all my MVC libraries with a previous (v4.0) version and it all worked.

查看更多
登录 后发表回答