C# StackExchange.Redis client failing to connect
I have deployed a Redis instance and I'm trying to connect to it using StackExchange.Redis but i get the error "It was not possible to connect to the redis server(s)".
but if I connect using the cli it works
8 Replies
Project ID:
0f54028f-2b4f-45ff-85ca-e7f3f2f1a4ea
0f54028f-2b4f-45ff-85ca-e7f3f2f1a4ea
1. please use environment variables in your code, never hardcore secrets/credentials
2. have you setup the redis variable references in your service variables?
1. I was doing a quick test to see if it would've connected so I didn't bother using env vars
2. What variables would need to be setup? After I created the service there were already variables
how long ago did you create the service?
5 minutes before I created this post
then you would need to setup the variable references in the service variables tab
https://docs.railway.app/develop/variables
scroll down to the reference variables section
If you mean that I need to reference plugin variables in the service env vars then
1) the project is still not hosted on railway so there is no point in doing it and
2) why would that not be a problem when connecting using
redis-cli railway_redis_url
?
Wdym then?
I have an update
After a bit of experimenting I found out that GetDatabase() needs a database number and that is causing the error
So how do I get the database number?