Signalr Cross-domain Javascript Client Hub Start Method Fails Only When Client Methods Are Subscribed
SignalR cross-domain javascript client hub start method fails only when client methods are subscribed. If client methods are not subscribed, hub start is successfully called and th
Solution 1:
Response status 500 (Internal Server Error) is about a null reference in the OnConnected method of the Hub. Was able to figure that out using the Fiddler.
Solution 2:
On the front end make sure you are NOT setting cors support
jQuery.support.cors = true //Do not put this
On the server, in your startup class, make sure cors is allowed by adding:
app.Map("/signalr", map =>
{
// Setup the CORS middleware to run before SignalR.// By default this will allow all origins. You can // configure the set of origins and/or http verbs by// providing a cors options with a different policy.map.UseCors(CorsOptions.AllowAll);
var hubConfiguration = new HubConfiguration
{
// You can enable JSONP by uncommenting line below.// JSONP requests are insecure but some older browsers (and some// versions of IE) require JSONP to work cross domain// EnableJSONP = true
};
// Run the SignalR pipeline. We're not using MapSignalR// since this branch already runs under the "/signalr"// path.map.RunSignalR(hubConfiguration);
});
Info on Cors/JSONP support can be found at: asp net
Post a Comment for "Signalr Cross-domain Javascript Client Hub Start Method Fails Only When Client Methods Are Subscribed"