1.一对一聊天
2.多对多
3.离线消息
1)群聊离线
2.1对一聊天离线
源码地址:https://github.com/aa1356889/SignalrCode
操作步骤
部署网站到iis
网上下载redis 打开redisServices
重启iis
codefirst生成数据库
时间有限就没有写管理界面 以下是我的配置的数据
USE [SignalrCodeDB] GO SET IDENTITY_INSERT [dbo].[Departments] ON GO INSERT [dbo].[Departments] ([DepartmentId], [ParentId], [DepartmentName], [OrganId], [Path]) VALUES (1, -1, N'销售部', 1, NULL) GO INSERT [dbo].[Departments] ([DepartmentId], [ParentId], [DepartmentName], [OrganId], [Path]) VALUES (3, -1, N'订单部', 1, NULL) GO SET IDENTITY_INSERT [dbo].[Departments] OFF GO SET IDENTITY_INSERT [dbo].[Menus] ON GO INSERT [dbo].[Menus] ([MenuId], [ParentId], [MenuName], [Seq], [Icon], [Area], [Controller], [Action]) VALUES (1, -1, N'个人中心', 0, N'fa fa-user', NULL, NULL, NULL) GO INSERT [dbo].[Menus] ([MenuId], [ParentId], [MenuName], [Seq], [Icon], [Area], [Controller], [Action]) VALUES (2, 1, N'我的控制台', 0, N'fa fa-desktop', NULL, N'MyConsole', N'Index') GO INSERT [dbo].[Menus] ([MenuId], [ParentId], [MenuName], [Seq], [Icon], [Area], [Controller], [Action]) VALUES (3, -1, N'工作流管理', 1, N'icon-grid', NULL, NULL, NULL) GO INSERT [dbo].[Menus] ([MenuId], [ParentId], [MenuName], [Seq], [Icon], [Area], [Controller], [Action]) VALUES (5, 3, N'添加工作流', 0, N'fa fa-file-o', NULL, NULL, NULL) GO SET IDENTITY_INSERT [dbo].[Menus] OFF GO SET IDENTITY_INSERT [dbo].[Organs] ON GO INSERT [dbo].[Organs] ([OrganId], [ParentId], [OrganName], [Path]) VALUES (1, -1, N'爱窝家居', NULL) GO SET IDENTITY_INSERT [dbo].[Organs] OFF GO SET IDENTITY_INSERT [dbo].[UserFriends] ON GO INSERT [dbo].[UserFriends] ([UserFriendsId], [UserId], [FriendsId]) VALUES (1, 3, 4) GO INSERT [dbo].[UserFriends] ([UserFriendsId], [UserId], [FriendsId]) VALUES (2, 3, 5) GO INSERT [dbo].[UserFriends] ([UserFriendsId], [UserId], [FriendsId]) VALUES (3, 4, 3) GO INSERT [dbo].[UserFriends] ([UserFriendsId], [UserId], [FriendsId]) VALUES (4, 4, 5) GO INSERT [dbo].[UserFriends] ([UserFriendsId], [UserId], [FriendsId]) VALUES (5, 5, 3) GO INSERT [dbo].[UserFriends] ([UserFriendsId], [UserId], [FriendsId]) VALUES (6, 5, 4) GO SET IDENTITY_INSERT [dbo].[UserFriends] OFF GO SET IDENTITY_INSERT [dbo].[Users] ON GO INSERT [dbo].[Users] ([UserId], [UserName], [LoginName], [PassWord], [HeadPath], [OrganId], [DepartmentId], [Phone], [IsOnline], [Remark]) VALUES (3, N'李强', N'liqiang', N'123', N'/plug/HeadPath/Desert.jpg', 1, 3, NULL, 0, NULL) GO INSERT [dbo].[Users] ([UserId], [UserName], [LoginName], [PassWord], [HeadPath], [OrganId], [DepartmentId], [Phone], [IsOnline], [Remark]) VALUES (4, N'张三', N'zhangsan', N'123', N'/plug/HeadPath/Lighthouse.jpg', 1, 3, NULL, 0, NULL) GO INSERT [dbo].[Users] ([UserId], [UserName], [LoginName], [PassWord], [HeadPath], [OrganId], [DepartmentId], [Phone], [IsOnline], [Remark]) VALUES (5, N'李四', N'lisi', N'123', N'/plug/HeadPath/Tulips.jpg', 1, 1, NULL, 0, NULL) GO SET IDENTITY_INSERT [dbo].[Users] OFF GO