Rest Angular2呼叫WCF服务失败
下面是调用WCF服务的代码Rest Angular2呼叫WCF服务失败,rest,angular,wcf,Rest,Angular,Wcf,下面是调用WCF服务的代码 public customLogin(user: string, pass: string): Observable<string> { let headers = new Headers({ 'Content-Type': 'application/json' }); let options = new RequestOptions({ method: "POST",headers: headers,body: user} );
public customLogin(user: string, pass: string): Observable<string> {
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ method: "POST",headers: headers,body: user} );
return this.http.post(this.url, user, options)
.map(this.extractData)
.catch(this.handleError);
}
本地服务器中的WCF服务url
)
它失败,出现405错误
有人知道可能是什么问题吗?您遇到了CORS问题。您显示的请求实际上是一个飞行前选项请求,而不是实际的飞行后选项请求,405-methodnotallowed表示WCF不允许选项方法 也许这也有帮助: