CodeMazeBlog/realtime-charts-signalr-angular

negotiation error

Closed this issue · 1 comments

After cloning the repo, I built and ran the server project.
I then installed:

  • @aspnet/signalr

  • ng2-charts

  • chart.js

in the client project. Ran ng serve. Opened my browser to localhost:4200 and get the following errors in the console
Error: Failed to complete negotiation with the server: Error
Error: Failed to start the connection: Error
GET https://localhost:5001/api/chart net::ERR_CONNECTION_CLOSED
ERROR HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: "Unknown Error", url: null, ok: false, …}

Got it working by changing the IISExpress settings as follows:
"applicationUrl": "http://localhost:5000",
"sslPort": 0
and changing all of the server URLs in the client project to not use a secure connection. i.e. http://localhost:5000

For whatever reason, if you don't disable the sslPort it will still try to resolve charts using https://localhost:5001, which causes failure.