【发布时间】:2017-07-22 02:41:42
【问题描述】:
我刚刚在我的一个开发服务器中安装了 REDIS 服务器。我正在尝试将我的本地主机应用程序与这个外部服务器连接起来。我正在使用 StackExchange.REDIS api 连接到位于我的内部开发服务器 10.26.130.170 的这个 REDIS 服务器。我安装了所有默认的 REDIS 软件,到目前为止没有进行任何自定义。
这是我项目中的连接类::
public sealed class RedisSingleton
{
private static Lazy<ConfigurationOptions> configOptions = new Lazy<ConfigurationOptions>(() =>
{
var configOptions = new ConfigurationOptions();
configOptions.EndPoints.Add("10.26.130.170:6379");
configOptions.ClientName = "MyAppRedisConn";
configOptions.ConnectTimeout = 100000;
configOptions.SyncTimeout = 100000;
configOptions.AbortOnConnectFail = true;
return configOptions;
});
private static Lazy<ConnectionMultiplexer> LazyRedisconn = new Lazy<ConnectionMultiplexer>(
() => ConnectionMultiplexer.Connect(configOptions.Value));
public static ConnectionMultiplexer ActiveRedisInstance
{
get
{
return LazyRedisconn.Value;
}
}
}
请提供一些建议。有没有一种方法可以让我快速检查我的本地主机,并使用 ping 或其他命令验证端口 6379 与 REDIS 服务器的连接。
redis的远程服务器上没有打开6379端口。我在 windows PortQueryUI 工具的帮助下找到了它。
【问题讨论】:
标签: asp.net redis stackexchange.redis