public void SendGroupMessage(string roomId, string message, string status)
{
// 调用房间内所有客户端的sendMessage方法
// 因为在加入房间的时候,已经将客户端的ConnectionId添加到Groups对象中了,所有可以根据房间名找到房间内的所有连接Id
// 其实我们也可以自己实现Group方法,我们只需要用List记录所有加入房间的ConnectionId
// 然后调用Clients.Clients(connectionIdList),参数为我们记录的连接Id数组。

var cook = JsonHelper.ToObject<LoginViewModel>(Context.User.Identity.Name);//改为这个上下文就行了,不用httpcontext.current
AspChat aspChat = new AspChat();
aspChat.RootId = Convert.ToUInt64(roomId);
aspChat.Comment = message;
aspChat.UpdateId = cook.UserId;
aspChat.UpdateTime = DateTime.Now;
//メッセージの保存
service.SaveChatRecord(aspChat, status);

if (!string.IsNullOrEmpty(message))
{
Clients.Group(roomId, new string[0]).sendMessage(cook.UserName, message, aspChat.UpdateTime.Value.ToString("yyyy-MM-dd hh:mm:ss"), Convert.ToBoolean(Convert.ToInt32(cook.IsAsp)));
}
}

Microsoft.AspNet.SignalR使用cookie丢失的更多相关文章

  1. Microsoft.AspNet.SignalR 2.2

    Nuget :http://www.nuget.org/packages/Microsoft.AspNet.SignalR/ What is SignalR? ASP.NET SignalR is a ...

  2. Microsoft.AspNet.SignalR实现弹幕(即时通讯)

    引用 Microsoft.AspNet.SignalR 服务器 自定义Connection public class BarrageConnection : PersistentConnection ...

  3. 在.net4的环境下使用Microsoft.AspNet.SignalR.Client 2.4.0

    我的环境是运行在.net 4 framework,并且使用了signalr 在重连的时候发现,运行的服务被关闭了.找不到合适的处理的办法.因为报错是 说明: 由于未经处理的异常,进程终止.异常信息: ...

  4. Asp.NetCore+Microsoft.AspNetCore.SignalR前后端分离

    1.新建WebApi 2.安装Microsoft.AspNetCore.SignalR 3.新建一个集线器和消息类 using Microsoft.AspNetCore.SignalR; using ...

  5. Microsoft.AspNet.Identity 的简单使用

    要完成一个简单的注册,登陆,至少需要实现Identity中的3个接口 IUser IUserStore<TUser> : IDisposable where TUser : IUser I ...

  6. Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with value '"*, Microsoft.AspNet.Mvc.TagHelpers"'

    project.json 配置: { "version": "1.0.0-*", "compilationOptions": { " ...

  7. VS2015突然报错————Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with value 'Microsoft.AspNet.Mvc.Razor.TagHelpers.UrlResolutionTagHelper

    Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with ...

  8. OWIN 中 K Commands(OwinHost.exe)与 Microsoft.AspNet.Hosting 的角色问题

    问题详情:K Commands(OwinHost.exe)是不是 OWIN 中的 Host 角色?如果是,那 Microsoft.AspNet.Hosting 对应的是 OWIN 中的哪个角色? OW ...

  9. Microsoft.AspNet.Identity 自定义使用现有的表—登录实现

    Microsoft.AspNet.Identity是微软新引入的一种membership框架,也是微软Owin标准的一个实现.Microsoft.AspNet.Identity.EntityFrame ...

随机推荐

  1. hbase 原子操作cas

    在高并发的情况下,对数据row1  column=cf1:qual1, timestamp=1, value=val1的插入或者更新可能会导致非预期的情况, 例如:原本客户端A需要在value=val ...

  2. Linux中的防火墙----iptables

    防火墙,它是一种位于内部网络与外部网络之间的网络安全系统.一项信息安全的防护系统,依照特定的规则,允许或是限制传输的数据通过. 防火墙根据主要的功能可分为网络层防火墙.应用层防火墙.数据库防火墙. 网 ...

  3. 【BZOJ4916】神犇和蒟蒻 解题报告

    [BZOJ4916]神犇和蒟蒻 Description 很久很久以前,有一群神犇叫sk和ypl和ssr和hjh和hgr和gjs和yay和xj和zwl和dcx和lyy和dtz和hy和xfz和myh和yw ...

  4. nmon

    http://www.cnblogs.com/me-sa/articles/centos0006.html

  5. Git 常用操作(二)

    第一次传数据:echo "# miya" >> README.mdgit initgit add README.mdgit commit -m "first ...

  6. mvc4同一视图传入两个模型

    http://bbs.csdn.net/topics/390961335 用ViewModel,把内容和评论构造到一个类中 这个简单,定义一个模型,包含两个属性,各自为那两个模型的类型,用这个模型.比 ...

  7. 在ASP.NET MVC中对表进行通用的增删改

    http://www.cnblogs.com/nuaalfm/archive/2009/11/11/1600811.html 预备知识: 1.了解反射技术 2.了解C#3.0中扩展方法,分布类,Lin ...

  8. ubuntu vim 配置

    set nuset autoindent cindentmap<F9> :w<cr> :!g++ -O2 -o %< % -Wall<cr>map<F1 ...

  9. 【Asp.net入门3-04】使用jQuery-使用jQuery事件

  10. 「Vue」实用组件

    一.时间格式 1.安装Moment模块 npm i moment -S2.main.js中设置全局过滤器 import moment from 'moment' Vue.filter('ctime', ...