I created a Console Application running on .NET Core 1.1 and I'm referencing the StackExchange.Redis NuGet package, version 1.2.3
When running the code below, I get the following error:
It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. SocketFailure on PING
using StackExchange.Redis;
using System;
namespace RedisConsoleApp
{
class Program
{
static void Main(string[] args)
{
ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost");
IDatabase db = redis.GetDatabase();
db.StringSet(BitConverter.GetBytes(5), "asdf");
}
}
}
If I change the Connect string to "localhost,abortConnect=false"
, then I get this error message:
No connection is available to service this operation: SET \0\0\0; SocketFailure on localhost:6379/Subscription, origin: Error, input-buffer: 0, outstanding: 0, last-read: 1s ago, last-write: 1s ago, unanswered-write: 27780s ago, keep-alive: 60s, pending: 0, state: Connecting, last-heartbeat: never, last-mbeat: -1s ago, global: 20s ago
I followed the Basics guide to get started using this library but I keep getting the errors above.
Am I missing some code or configuration?
It sounds like you might have only set up the StackExchange.Redis client, did you install and start up your local Redis server? If not, use HomeBrew to download and install Redis on your machine
brew install redis
brew services start redis
and start the server with
redis-server
Try adding ssl=True,abortConnect=False,sslprotocols=tls12
under your connection string
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.