【发布时间】:2014-12-15 22:15:01
【问题描述】:
基本上我正在尝试访问我在 Azure 上上传的 web api。
我已将我的 CORS 属性添加到我的 WebApiConfig 类中:
public static void Register(HttpConfiguration config)
{
var cors = new EnableCorsAttribute("http://localhost:51407", "*", "*");
config.EnableCors(cors);
但是,每当我发送正确包含的 Ajax 请求(使用 angularJS)时
Origin: http://localhost:51407
我得到错误:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:51407' is therefore not allowed access.
可能是什么问题?
【问题讨论】:
标签: angularjs api azure asp.net-web-api cors