使用Azure Redis Cache存储会话数据和SignalR Backplane

时间:2016-02-18 13:50:06

标签: asp.net session azure azure-redis-cache signalr-backplane

因此,我正在准备一个较旧的企业级ASP.net解决方案,以转移到Azure。我们希望将单个Azure Redis缓存用于会话状态和SignalR背板。

作为团队的新成员,不熟悉SignalR,我构建了教程 here作为起点。从那里,我设置了Session-State提供程序,并且能够实现这一点。我做了一篇关于它的博客文章,但我还没有足够的声誉可以分享。 :/

但是当实施SignalR Redis背板时,我没有成功。

这是我尝试过的代码:

using System;
using System.Configuration;
using Microsoft.AspNet.SignalR;
using Owin;
using Microsoft.Owin;
[assembly: OwinStartup(typeof(SignalRChat.Startup))]
namespace SignalRChat

{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            if (ConfigurationManager.AppSettings["redis.enabled"] != null &&
                bool.Parse(ConfigurationManager.AppSettings["redis.enabled"]))
            {
                GlobalHost.DependencyResolver.UseRedis(ConfigurationManager.AppSettings["RedisCacheUrl"], 6380, ConfigurationManager.AppSettings["RedisCachePassword"], "Chat");
                app.MapSignalR();
            }
       }
    }       
}

This is an example of the error I get when firing up the website, and navigate to the page where SignalR calls are being made.

有人成功地这样做了吗?

0 个答案:

没有答案