I have a Angular 7 Application with .Net core 2.1, once the application is publish it cannot reach the API, which means no calls can be made, but before i published the application everything worked fine.
What could be the problem and how can i fix this?
Example of a call in my code that checks if the API is accessible:
(this is the first call in my application)
let availabilityHTTPCall = this.http.get("/v1/CheckAvailability");
availabilityHTTPCall.subscribe(
(result: boolean) => {
this._webApiUnavalable = result;
this.wizardOpen = true;
console.log("HTTP Call returned data without error!", result);
},
(error) => {
console.log("HTTP Call returned an error!", error);
this._webApiUnavalable = false;
},
() => {
console.log("HTTP Call complete!");
this.PlacesOfService();
this.LoadPhCodes();
}
);
What the API looks like in the controller:
[HttpGet]
[Route("CheckAvailability")]
public Boolean CheckAvailability()
{
return true;
}
The error i get from my call:
"Http failure during parsing for http://localhost/"
"Unexpected token < in JSON at position 0"
What I have tried:
i have tried to insert a hashtag in-front of my URL of my API call which did not work, since this worked for fixing the reloading of my pages once published.