Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It was not possible to connect to the redis server(s). There was an authentication failure... #1463

Closed
FilipCotan opened this issue May 15, 2020 · 3 comments

Comments

@FilipCotan
Copy link

Hi guys,

I'm using StackExchange.Redis version 2.1.30 to connect to an Azure Hosted Redis.
I am getting the following exceptions:

  1. when I try to SET a string value (~6.5 KB):
    ProblemId: **System.Net.Sockets.SocketException at StackExchange.Redis.ExtensionMethods.AuthenticateAsClient**
    No connection is active/available to service this operation: SET <key>; A blocking operation was interrupted by a call to WSACancelBlockingCall, mc: 1/1/0, mgr: 10 of 10 available, clientName: <client-name>, IOCP: (Busy=2,Free=998,Min=2,Max=1000), WORKER: (Busy=1,Free=32766,Min=2,Max=32767), v: 2.1.30.38891

  2. when I try to GET a string value:
    ProblemId: **StackExchange.Redis.RedisConnectionException at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl**
    No connection is active/available to service this operation: GET <key>; It was not possible to connect to the redis server(s). There was an authentication failure; check that passwords (or client certificates) are configured correctly. ConnectTimeout, mc: 1/1/0, mgr: 10 of 10 available, clientName: <client-name>, IOCP: (Busy=2,Free=998,Min=2,Max=1000), WORKER: (Busy=1,Free=32766,Min=2,Max=32767), v: 2.1.30.38891

Note: I am only getting these exceptions when I run the ASP.NET Web Services application from my CI and Stage environment (did't go to prod yet). If I run the application locally, it works (tried to connect to both CI and Stage redis services). Also, for testing purposes, I created a simple redis client console application that I deployed on the CI environment, and using the console application, I can successfully connect to Redis. Note that I used the exact same approach to connect to redis as per the ASP.NET Web Services application.

Connection implementation:

public class RedisConnection
{
    private static readonly string _connectionString = "hostname:6380,password=<valid-password>,ssl=True,abortConnect=False"; //hard coded from web.config

    private static readonly Lazy<ConnectionMultiplexer> LazyConnection;

    static RedisConnection()
    {
        LazyConnection = new Lazy<ConnectionMultiplexer>(() => ConnectionMultiplexer.Connect(_connectionString));
    }

    public static ConnectionMultiplexer Connection => LazyConnection.Value;

    public static IDatabase RedisCache => Connection.GetDatabase();
}

And then use it as

...
private readonly IDatabase _redis = RedisConnection.RedisCache;
...

Any help would be much appreciated.

Filip

@mgravell
Copy link
Collaborator

what framework is this? two thoughts occur:

@FilipCotan
Copy link
Author

Thanks for your fast reply, @mgravell . It's an ASP.NET ASMX Web Service project. It was appending the ,sslprotocols=tls12 to the connection string that fixed the issue. There's a min TLS version setting in Azure set to TLS12 but I ignored it since it worked from a console app on the same machine, with the same connection string.

This issue can be now closed. Thank you once again, @mgravell. Cheers!

@mgravell
Copy link
Collaborator

it worked from a console app on the same machine

Different runtimes / framework versions, probably :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants