Jen*_*112 7 api azure cors asp.net-web-api angularjs
基本上我正在尝试访问上传到Azure上的web api.
我已将我的CORS属性添加到我的WebApiConfig类:
public static void Register(HttpConfiguration config)
{
var cors = new EnableCorsAttribute("http://localhost:51407", "*", "*");
config.EnableCors(cors);
Run Code Online (Sandbox Code Playgroud)
但是每当我发送一个正确包含的Ajax请求(使用angularJS)时
Origin: http://localhost:51407
Run Code Online (Sandbox Code Playgroud)
我收到错误:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:51407' is therefore not allowed access.
Run Code Online (Sandbox Code Playgroud)
可能是什么问题?
我还在 Azure 网站中使用 webapi2 和 AngluarJS 客户端(不同的服务器)。
请检查我的答案:https ://stackoverflow.com/a/25758949/361100
如果无法解决问题,请查看上述链接的其他答案。
| 归档时间: |
|
| 查看次数: |
7539 次 |
| 最近记录: |