5

How do I enable the CORS option in asp.net WebApi? I installed the package Microsoft.AspNet.WebApi.Cors from nuget for CORS support. However, I am getting an error stating that IAppBuilder does not contain definition for app.useCors?

7
  • can you share the code you have tried? Commented Feb 1, 2017 at 18:08
  • app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll); Commented Feb 1, 2017 at 18:54
  • Have you tried everything in this answer? stackoverflow.com/questions/20079813/… Commented Feb 1, 2017 at 19:00
  • yes but app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll); says IaapBuilder could not found definition for UseCors Commented Feb 1, 2017 at 19:17
  • Have you installed the Microsoft.AspNet.WebApi.OwinSelfHost and Microsoft.Owin.Cors NuGet packages? Commented Feb 1, 2017 at 19:31

1 Answer 1

9

Make sure you have installed the Microsoft.AspNet.WebApi.OwinSelfHost and Microsoft.Owin.Cors NuGet packages.

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

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.