Angular2とASP MVC restサーバーで休憩アプリケーションがあり、通信に問題があります。 私が得る送信すると、私はこのエラーを取得する:私は要求するアクセス制御 - 許可 - 起源を追加するとAngular2 - HTTPヘッダーアクセスコントロール付きASP MVC Web API
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://localhost:4200 ' is therefore not allowed access.
は、私はこのエラーを取得する:ここで
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://localhost:4200 ' is therefore not allowed access. The response had HTTP status code 404.
は私のコードです:
let headers = new Headers({ 'Access-Control-Allow-Origin': '*' })
this.http.get("http://localhost/App/Users", { withCredentials: true, headers: headers })
.subscribe(response => {
console.log("A");
}, error => {
console.log(error);
});
Windows認証では、web.configが有効になっています。 どこに問題がありますか?
ウェブAPIでコルスを有効にするにはどうすればよいですか? – hasan