Here is what I finally found to work for me; hopefully this will help you as well. This is as of Visual Studio 2015 in early March 2017.
- Add nuget packages to the web api project:
- Microsoft.AspNet.WebApi.Cors
- Microsoft.Owin.Cors (this will also install Microsoft.AspNet.Cors)
- Modify startup.cs, Configuration(IAppBuilder app), add this line:
app.UseCors(CorsOptions.AllowAll);
and add it before the line:
app.UseWebApi(config); - Add the following attribute on my web api controller class:
[EnableCors("*", "*", "*")]
These three steps got things finally working.
No comments:
Post a Comment