MVC5 使用SignalR记录

1.安装以下安装包

还有下面这个可以加载js文件10

 

 

 

 

 

2.web项目增加以下类

using Microsoft.AspNet.SignalR;
using Microsoft.Owin;
using Microsoft.Owin.Cors;
using Owin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

[assembly: OwinStartup(typeof(XXXXX.Startup))]
namespace XXXX
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {

app.Map("/signalr", map =>
            {
           map.UseCors(CorsOptions.AllowAll);
var hubConfiguration = new HubConfiguration { EnableJSONP = true }; map.RunSignalR(hubConfiguration); }); app.MapSignalR(); } } }

 

posted @ 2021-11-18 14:47  LoveMe7788  阅读(51)  评论(0编辑  收藏  举报