additional redis tweaks
This commit is contained in:
parent
e9441d510e
commit
baba3bd6c2
@ -5,6 +5,8 @@ using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
|
||||
namespace BinaryDad.Coding
|
||||
{
|
||||
@ -21,7 +23,32 @@ namespace BinaryDad.Coding
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddMvc();
|
||||
services.AddSignalR().AddStackExchangeRedis("redis");
|
||||
services.AddSignalR().AddStackExchangeRedis("redis", options =>
|
||||
{
|
||||
options.ConnectionFactory = async writer =>
|
||||
{
|
||||
var config = new ConfigurationOptions
|
||||
{
|
||||
AbortOnConnectFail = false
|
||||
};
|
||||
|
||||
//config.SetDefaultPorts();
|
||||
|
||||
var connection = await ConnectionMultiplexer.ConnectAsync(config, writer);
|
||||
|
||||
connection.ConnectionFailed += (_, e) =>
|
||||
{
|
||||
Console.WriteLine("Connection to Redis failed.");
|
||||
};
|
||||
|
||||
if (!connection.IsConnected)
|
||||
{
|
||||
Console.WriteLine("Did not connect to Redis.");
|
||||
}
|
||||
|
||||
return connection;
|
||||
};
|
||||
});
|
||||
|
||||
services.AddHttpsRedirection(options =>
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user