Getting Microsoft.AspNet.WebApi.Cors version in WebAPI

I installed the Microsoft.AspNet.WebApi.Cors package using the Install-Package Microsoft.AspNet.WebApi.Cors in my WebApi project (.net framework 4.5.2) and now I get below errors when compiling the project.

Link: http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api

Assembly 'System.Web.Http.Cors, Version = 5.2.3.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35' uses 'System.Web.Http, Version = 5.2.3.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35', which has more higher version than the reference assembly 'System.Web.Http, Version = 5.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35'

+6
source share
3 answers

To do this, you need to install the following nuget package.

Installation Package Microsoft.AspNet.WebApi.Cors.ko -Version 5.0.0

This will work.

+8
source

make sure your packages are up to date. if you are updating and you still have the same error - delete the packages one by one until you get your system.web.http, disappear from the links - then add the links again, this should fix your build error

0
source

I had the same problem, but "Update-Package -reinstall Microsoft.AspNet.Cors" fixed my problem

  • -
0
source

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


All Articles