7

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'

3
  • What version of Web API is used in project? Commented Mar 13, 2015 at 12:34
  • I'm having the same EXACT issue almost a year later, working in VS2015. Commented Mar 18, 2016 at 16:57
  • Solution is marked below. Commented Mar 21, 2016 at 6:32

3 Answers 3

9

You need to install following nuget package for this.

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

This will work.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, I uninstalled the previous one and installed the lower version & it worked well.
You don't need the .ko (Korean version), Microsoft.AspNet.WebApi.Cors is enough...
0

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

2 Comments

installing version webapi 5.0.0 means going down to a previous version which can cause other problems. there is no need to downgrade to lower version just fix the latest version reference
@MohanadHaddadin You're right. You'd have to fix the dependency chain accordingly when you downgrade.
0

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

    -

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.