Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Signalr negotiate url fails

Trying to get signalr up and running. I keep getting 2 errors back from the server:

  1. GET negotitate url returns 500 Internal Server Error
  2. XMLHttpRequest cannot load http://localhost:10772//signalr/negotiate ... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 500.

Screenshot provided.

Any ideas?

enter image description here]1

like image 810
hannes neukermans Avatar asked Oct 12 '16 18:10

hannes neukermans


1 Answers

OK, found it out myself. Spelling error. The name of the hub mentioned was incorrect.

changed:
var proxy = this.connection.createHubProxy('chattAppHub');

to:
var proxy = this.connection.createHubProxy('ChatAppHub');

In the backend:
[HubName("ChatAppHub")]
public class ChatAppHub : Hub ...

inside startup.cs
var hubConfiguration = new HubConfiguration(); hubConfiguration.EnableDetailedErrors = true; appBuilder.MapSignalR(hubConfiguration); appBuilder.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);

like image 116
hannes neukermans Avatar answered Oct 21 '22 11:10

hannes neukermans