Using persistent connections and an ASP.NET JavaScript client, I am trying to connect to a sub-domain not the same as the one the page was served from.
ASP.Net Page from webserver sub1.mydomain.com
wants to connect to SignalR at sub2.mydomain.com
. The same code works fine when connecting within the same sub-domain.
I found another post where cross-domain connections were enabled with:
jQuery.support.cors = true;
but this did not work for me.
How can I connect to SignalR in a second sub-domain using persistent connection and a JavaScript client?
You need to do one of the following to make it work:
$.connection.hub.url = 'http://subdomain.domain.com/signalr';
, pointing to your subdomain.Enable cross domain on the server:
RouteTable.Routes.MapHubs(new HubConfiguration()
{
EnableCrossDomain = true
});