【发布时间】:2015-01-06 16:24:41
【问题描述】:
我已将 nuget 包 Microsoft.AspNet.SignalR.Redis 添加到我的项目中,以允许我按照以下说明使用 redis 缓存背板扩展我的 signalR 应用程序:
http://www.asp.net/signalr/overview/performance/scaleout-with-redis
我已经在 Azure 上设置了一个 redis 缓存服务器,并且使用与端口 6379 的非安全连接一切正常。
我现在想启用 SSL 以增加安全性,但似乎不支持使用 nuget 插件进行 SSL 连接:
如果我尝试使用安全端口 6380,nuget 包似乎不支持 SSL 连接。
例子:
GlobalHost.DependencyResolver.UseRedis("redis-server.cloudapp.net", 6380,
"Password/Key", "ChatApp")
这些不是启用 SSL 的开关
这是连接的完整代码:
public class Startup
{
public void Configuration(IAppBuilder app)
{
// Configuration for scale out using Redis:
var redisEnabled = Convert.ToBoolean(WebConfigurationManager.AppSettings["RedisScaleOut_Enable"]);
if (redisEnabled)
{
var redisHost = WebConfigurationManager.AppSettings["RedisScaleOut_Host"];
var redisPort = Convert.ToInt16(WebConfigurationManager.AppSettings["RedisScaleOut_Port"]);
var redisPassword = WebConfigurationManager.AppSettings["RedisScaleOut_Password"];
var redisAppName = WebConfigurationManager.AppSettings["RedisScaleOut_AppName"];
GlobalHost.DependencyResolver.UseRedis(redisHost, redisPort, redisPassword, redisAppName);
}
// Branch the pipeline here for requests that start with "/signalr"
app.Map("/signalr", map =>
{
// Setup the CORS middleware to run before SignalR.
// By default this will allow all origins. You can
// configure the set of origins and/or http verbs by
// providing a cors options with a different policy.
map.UseCors(CorsOptions.AllowAll);
var hubConfiguration = new HubConfiguration
{
// You can enable JSONP by uncommenting line below.
// JSONP requests are insecure but some older browsers (and some
// versions of IE) require JSONP to work cross domain
EnableJSONP = true
};
// Run the SignalR pipeline. We're not using MapSignalR
// since this branch already runs under the "/signalr"
// path.
map.RunSignalR(hubConfiguration);
});
}
}
【问题讨论】: