Enabled CORS on one project, trying to do it on another existing project, however the "EnableCors" method cannot be found in during compilation:
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.EnableCors();
The exact compile fail error message is
'HttpConfiguration' does not contain a definition for 'EnableCors' and no extension method 'EnableCors' accepting a first argument of type 'HttpConfiguration' could be found (are you missing a using directive or an assembly reference)
I've done the same thing in this project as I have the other project:
<package id="Microsoft.AspNet.Cors" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi.Cors" version="5.2.3" targetFramework="net451" />
This project has odata in it though...I'm not sure if that's the major difference making it fail.
Any ideas? I've also tried
Update-Package -reinstall Microsoft.AspNet.WebApi.Cors
I had to reinstall all the packages - THEN the compile error went away.
Weird. I had built & cleaned the project several times.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With