Jitendra Pancholi
Jitendra Pancholi

Reputation: 7562

Getting Microsoft.AspNet.WebApi.Cors version issue in WebAPI

I have installed Microsoft.AspNet.WebApi.Cors package using Install-Package Microsoft.AspNet.WebApi.Cors in my WebApi project(.net framework 4.5.2) and now I'm getting below error while compiling the project.

Reference: 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 a higher version than referenced assembly 'System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Upvotes: 7

Views: 6923

Answers (3)

Jemil Oyebisi
Jemil Oyebisi

Reputation: 653

I had same issue, but doing this "Update-Package –reinstall Microsoft.AspNet.Cors" fixed my problem

    -

Upvotes: 0

Mohanad Haddadin
Mohanad Haddadin

Reputation: 589

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

Upvotes: 0

Pankaj Sharma
Pankaj Sharma

Reputation: 254

You need to install following nuget package for this.

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

This will work.

Upvotes: 9

Related Questions