No HTTP resource error when doing PUT/POST [CORS issue - AngularJS + Web API 2]

前端 未结 2 1155
我在风中等你
我在风中等你 2021-01-13 13:13

There are so many questions in SO similar to this, but none have fixed my issue.

I\'ve have an angularjs website hosted at http://localhost:49595 and I\

2条回答
  •  清酒与你
    2021-01-13 14:04

    I had issues getting it to work with the the values in the config so I removed them from there and I added the following to my WebApiConfig class:

            //Specify values as appropriate (origins,headers,methods)
            var cors = new EnableCorsAttribute("http://myurl","*","*");
            config.EnableCors(cors);
    

    You can find the nuget package for Microsoft ASP.NET Web API 2.2 Cross-Origin from here

提交回复
热议问题