Ibanez1408
Ibanez1408

Reputation: 5058

net: ERR_CONNECTION_REFUSED when accessing web api from angular2 application

I have setup my backend Web API created in VS2015 in the IIS server and I can access it via URL

http://192.168.137.15:53610/

I have ng-build --prod my frontend angular2 application and served it using http-serve inside the dist folder which I access via URL

http://192.168.137.15:8080/index.html

If I access the frontend in my pc, I can access the webapi so I can login. But if I access my frontend from a LAN, I can access the frontend because I can get to the login screen. But as soon as I click the submit button, I get the error of

OPTIONS http://localhost: polyfill.4afb43cdae.....bundle.js:153610/token net::ERR_CONNECTION_REFUSED

. Can you please show me how to do this right. Thank you.

Upvotes: 0

Views: 3444

Answers (1)

Brando Zhang
Brando Zhang

Reputation: 28077

According to the error message, it seems you have send option request to localhost instead of the 192.168.137.15:53610. I suggest you could check you angular codes to make sure you send the request to right url.

Upvotes: 2

Related Questions