SignalR不会在服务器上使用Session

编程入门 行业动态 更新时间:2024-10-27 10:32:42
本文介绍了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

本文发布于:2023-10-29 10:41:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1539469.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:会在   器上   SignalR   Session

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!