我有一个项目,我启用了CORS
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "http://localhost:63736");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "POST,GET,DELETE,PATCH,PUT,OPTIONS");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept,WWW-Authenticate");
调用... / api / login使用jquery传递确定当我尝试用微风查询odata时我得到了cors错误
XMLHttpRequest cannot load http://localhost:53809/odata/Metadata. Origin http://localhost:63736 is not allowed by Access-Control-Allow-Origin.
怎么回事?
答案 0 :(得分:1)
Ward在这篇文章中发布了一些关于CORS的好信息: Using Breeze with a WebApi Service from another domain
首先看看它,看看它是否解决了你的问题。