SignalR不会在服务器上使用Session [英] SignalR doesn't use Session on server

查看:2191
本文介绍了SignalR不会在服务器上使用Session的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试访问从它返回

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

我试图利用该接口 IRequiresSession ,但没有奏效。有人可以帮我吗?

I tried making use of the interface IRequiresSession but it didn't work. Can someone help me?

推荐答案

SignalR连接(包括潜在客户端的所有集线器操作的连接)不支持会话状态。你可以启用它,如果你想,但我们强烈建议反对的会话状态序列化的访问对于给定的客户端请求,这意味着你不会真正得到SignalR双工通信好处了,因为一个请求会阻塞其它如在长轮询传输,接收的连接将阻止任何企图发送。

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.

这篇关于SignalR不会在服务器上使用Session的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆