Reputation: 4588
Below angular code which calls the WCF service.
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 service url in local
'http://localhost:34244/CitizenService.svc/register';
It fails with 405 error.
Anyone knows what could be the issue?
Upvotes: 0
Views: 1648
Reputation: 4912
You're having a CORS issue here. The request you're showing is actually a pre-flight OPTIONS request (not yet the actual POST request)and the 405 - Method not allowed indicates that WCF doesn't allow the OPTIONS method.
Maybe this is also helpful: How to add cross domain support to WCF service
Upvotes: 1