0
我试图使用ASP.NET MVC Web API构建一个角度应用程序。Cors不解决跨源请求
当我做出$资源请求我的Web服务器(本地主机),我得到
的XMLHttpRequest无法加载http://localhost:59636/api/studios。请求的资源上没有“Access-Control-Allow-Origin”标题。因此'Origin'http://localhost:44060'不允许访问。答案有HTTP状态代码401.
我读过安装Cors会解决这个问题。但它没有。我曾经尝试都使CORS
config.EnableCors(new EnableCorsAttribute("*", "*", "*"));
以及使用该属性
[EnableCorsAttribute("*", "*", "*")]
它正在研究IE
仍然没有工作。我已注释掉 '//config.SuppressDefaultHostAuthentication(); //config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));' 并从控制器中删除授权属性 – den