I am calling a web api method as shown below from angular,But web api methods are executed two times.Any idea why it is happening here. I have put a console log in origin ,angular code and confirmed that it is called one time from angular.BUt strange web api methods are executed two times, something like running on thread.
Angular code
public Createsamples(): Observable<any> {
var url = this.baseApiUrl + 'Test/Createsamples';
return this.httpService.post(url, JSON.stringify(obj), { headers: reqHeader, withCredentials: true });
}
Web api code
[System.Web.Http.RoutePrefix("api/Test")]
[EnableCors(origins: "*", headers: "*", methods: "*")]
public class TestApiController
{
[Route("Createsamples")]
[System.Web.Http.HttpPost]
public IHttpActionResult Createsamples()
{
TestBO Bo = new TestBO ();
var result = Bo.Createsamples(obj);
return Ok(result);
}
}