Hello i am using Redis and i am not able to connect to it when i am using a domain except localhost.
StackExchange.Redis.RedisConnectionException: 'No connection is available to service this operation: HEXISTS files; UnableToConnect on [someDomain.com]:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 1s ago, last-write: 1s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 0s ago, v: 2.0.593.37019; IOCP: (Busy=0,Free=1000,Min=8,Max=1000), WORKER: (Busy=0,Free=32767,Min=8,Max=32767), Local-CPU: n/a'
The multiplexer connects and also the flag is of IsConnecting
is false.So the connection is done.
class Program {
// public const string CON = "127.0.0.1:6379,ssl=False,allowAdmin=True,abortConnect=False,defaultDatabase=0";
public const string CON = "someDomain.com:6379,ssl=False,allowAdmin=True,abortConnect=False,defaultDatabase=0";
public static async Task<bool> LockFileForEditAsync(int fileId) {
var multiplexer = ConnectionMultiplexer.Connect(CON);
var flag = multiplexer.IsConnecting;
var database = multiplexer.GetDatabase();
var exists = await database.HashExistsAsync("files", fileId); //crashes here !!
return false;
}
static async Task Main(string[] args) {
int fid = 1;
var locked = await LockFileForEditAsync(fid);
}
}
PS I have checked this thread regarding thread theft and i can not find a solution. So why would it work to connect on localhost, and not from another computer to the same redis-server?