Skip to content Skip to sidebar Skip to footer

Signalr Client Hub Proxy Is Undefined

I was following this tutorial. On client side, in a simple html page, I get undefined for the client hub proxy from SignalR; What am I missing? This links work properly (client is

Solution 1:

You need to enable CORS support on your server for cross domain to work (I'll also list how to enable jsonp).

To Enable Cors:

  1. Install Microsoft ASP.NET Cross-Origin Support via nuget (Microsoft.Owin.Cors)
  2. Add this to your startup file (before your map signalr call):

:

app.UseCors(CorsOptions.AllowAll); // You can modify the CorsOptions

To Enable JSONP:

Modify your "MapSignalR" in your startup file via:

app.MapSignalR(new HubConfiguration
{
    EnableJSONP = true
});

To do both together you can do:

app.UseCors(CorsOptions.AllowAll)
    .MapSignalR(new HubConfiguration
    {
        EnableJSONP = true
    });

Keep in mind enabling these cross domain features on your SignalR server exposes it to potential security vulnerabilities.

Post a Comment for "Signalr Client Hub Proxy Is Undefined"