SignalR doesn't use Session on server

后端 未结 3 1089
青春惊慌失措
青春惊慌失措 2020-12-01 15:30

When I try to access the HttpContext current session from the HUB it returns null.

I tried making use of the interface IRequiresSessi

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 16:26

    SignalR connections (including the connection underlying all Hub operations for a client) do not support Session state. You could enable it if you wanted to but we'd strongly recommend against it as session state access serializes requests for a given client, meaning you won't really get the benefit from SignalR duplex messaging anymore, as one request will block the other e.g. in the long polling transport, the receiving connection will block any attempt to send.

提交回复
热议问题