나는 서비스를 구성 :
Plugins.Add(new CorsFeature(
allowCredentials: true,
allowedMethods: "GET, POST, PUT, DELETE, OPTIONS",
allowedHeaders: "Content-Type, Allow, Authorization, Origin",
allowOriginWhitelist: new[]
{
"http://localhost:4200",
"http://localhost:63342",
"http://localhost:63342",
"http://localhost:3000",
"http://my.site.com"
}));
나는이 개 기능을 로그인() 및 GetContacts()
class AppComponent {
***
constructor(){
this.client = new JsonServiceClient("http://my.site.com");
this.client.credentials = "omit";
}
async Login(){
var auth = new wbs.Authenticate();
auth.UserName = this.username;
auth.Password = this.password;
var authResponse = await this.client.post(auth);
console.log(authResponse);
}
async GetContacts(){
try {
this.contacts = await this.client.post("Contacts_Get");
console.log(this.contacts);
} catch(e) {
this.contacts = [];
console.log("Failed to get:", e.responseStatus);
}
}
}
"servicestack 클라이언트"가 " 0.030 ",
이러한 함수를 차례로 호출합니다.
1. Login()
2. ContactsGet()
로그인은 정상적으로 실행되지만 Internet Explorer 및 Safari ContactsGet은 실패하지만 상태 401을 반환하지만 Chrome에서 작동합니다.
제발 내 실수로 안내는? 감사합니다.



UPDATE
IIS 설정

여전히 작동하지 않습니다 :'프리 플라이트 요청에 대한 응답이 액세스 제어 검사를 통과하지 못합니다 : 응답의 'Access-Control-Allow-Origin'헤더의 값은 요청의 자격 증명 모드 '포함'입니다. 따라서 Origin 'https : /my-app2.azurewebsites.net'은 액세스가 허용되지 않습니다. ' – lucuma
다른 화이트리스트 도메인에서 정답을 사용하는 응답의 예를 업데이트했습니다. –
나는 그것을 또한 시험해 보았다. 나는이 문제를 알아 냈다. CORS 설정이 백엔드가 아니라 프론트 엔드의 JsonServiceClient였다. 나는'client.credentials = "생략"을 설정해야했다. – lucuma