【发布时间】:2015-06-14 23:28:05
【问题描述】:
我正在尝试使用 ASP.NET MVC Web API 构建一个 Angular 应用程序。
当我向我的网络服务器 (localhost) 发出 $resource 请求时,我得到了
XMLHttpRequest 无法加载 http://localhost:59636/api/studios。请求的资源上不存在“Access-Control-Allow-Origin”标头。因此,Origin 'http://localhost:44060' 不允许访问。响应的 HTTP 状态代码为 401。
我读到安装 Cors 可以解决这个问题。但它没有。我已经尝试过启用 cors
config.EnableCors(new EnableCorsAttribute("*", "*", "*"));
以及使用属性
[EnableCorsAttribute("*", "*", "*")]
它正在 IE 上运行
【问题讨论】:
标签: asp.net angularjs webserver