5

I am writing a web app using SignalR cross domain communication. I am using the latest version of SignalR, 1.0.1. Following is the code in the jQuery's document ready event:

var connection = $.hubConnection(url);
  var proxy = connection.createHubProxy(hubName);

  connection.start().done(function () {
    proxy.invoke('serverMethod');
  });

I tried running the application on Opera, Firefox, Chrome and IE 10. My OS is Windows 7. It works well on IE 10 and doesn't work on other browsers. I changed mode of IE using developer tools to IE 9, and it stopped working. The same code works on all browsers if I use SignalR version 0.5.3.

In developer tools of the browser, I found the following HTTP status code in response of negotiation request: "HTTP/1.1 403 Forbidden".

Am I missing anything here? What is the reason because of which it is breaking on browsers other than IE 10?

S. Ravi Kiran
  • 4,053
  • 3
  • 21
  • 26

1 Answers1

12

Ensure that in your MapHubs call that you enable cross domain.

RouteTable.Routes.MapHubs(new HubConfiguration() { EnableCrossDomain = true });

When testing cross domain locally IE10 has an interesting feature that treats any localhost port as not being cross domain.

N. Taylor Mullen
  • 18,061
  • 6
  • 49
  • 72
  • New method for this: http://www.asp.net/signalr/overview/guide-to-the-api/hubs-api-guide-javascript-client#crossdomain – dudeNumber4 Oct 09 '15 at 17:54