Context.User is null in a Signalr 2.0 Hub

前端 未结 1 487
花落未央
花落未央 2021-01-13 03:12

I\'m using VS 2013 Express and the standard MVC5 template to create a new clean app. Authentication is enabled and I can log into the site just fine. I can see the user cont

1条回答
  •  星月不相逢
    2021-01-13 03:44

    The resolution to the program was very simple. In my startup class I had the code in the wrong order.

    This is what I had when it wasn't working:

        app.MapSignalR();
        ConfigureAuth(app);
    

    However, this is the correct order to have Signalr work with authentication:

        ConfigureAuth(app);
        app.MapSignalR();
    

    This may be a no-brainer for most, but I think it's an easy mistake to make.

    0 讨论(0)
提交回复
热议问题