Can't load System.Web.Cors assembly after call to Microsoft.Owin.Cors Can't load System.Web.Cors assembly after call to Microsoft.Owin.Cors asp.net asp.net

Can't load System.Web.Cors assembly after call to Microsoft.Owin.Cors


Turns out System.Web.Cors.dll does not come from the Microsoft.AspNet.WebApi.Cors package. It comes from the Microsoft.AspNet.Cors package.

Install-Package Microsoft.AspNet.Cors -Version 5.0.0

This resolved the immediate error.

In case you have a scenario in which you need two different versions of the System.Web.Cors.dll, I'd suggest this solution:

  1. Using the Package Manager, change the version of Microsoft.AspNet.Cors to the version that Microsoft.Owin.Cors requests in its manifest definition.
  2. Using the Developer Command Prompt for Visual Studio (run as admin), navigate to the package folder for the newly versioned Microsoft.AspNet.Cors where the *System.Web.Cors.dll** resides.
  3. Run the following command: gacutil -i System.Web.Cors.dll.
  4. Go back to the Package Manager and change Microsoft.AspNet.Cors back to the version you originally wanted.

This method simply pulls the desired version of the .dll file into your Solution's packages folder. Then you use gacutil.exe to add this version of the .dll to your Global Assembly Cache. Visual Studio probes for the desired .dll versions first in the GAC, then in your local project.


run this command into PM (package manager)

Install-Package Microsoft.AspNet.Cors -Version 5.2.3.0