I'm trying to connect to IBM databases for redis instance from ibmcloud functions for days but i had no luck. I tried using ibmcloud supported version .netcore 2.2 and docker image core 3.1.
I can connect to redis without anyerrors from a local console app using code below.
I need your help. Thank you.
public IbmRedisClient(JObject args)
{
X509Store store = new X509Store(StoreName.Root);
var base64 = (string)args.GetValue("redis_connection_certbase64");
string connURL = (string)args.GetValue("redis_connection_string");
connURL = connURL.Replace("$PASSWORD", PASSWORD);
Console.WriteLine("base: " + base64);
X509Certificate2 ca = new X509Certificate2(Convert.FromBase64String(base64));
var EndPointCollection = new EndPointCollection();
var options = new ConfigurationOptions
{
AbortOnConnectFail = false,
Ssl = true,
ConnectRetry = 3,
ConnectTimeout = 5000,
SyncTimeout = 5000,
DefaultDatabase = 0,
Password = "testadminpassword"
};
options.EndPoints.Add(host, 32326);
options.EndPoints.Add(host, 0);
options.CertificateSelection += delegate
{
return ca;
};
try
{
ConnectionMultiplexer muxer = ConnectionMultiplexer.Connect(options);
conn = muxer.GetDatabase();
}
catch (Exception ex)
{
Console.WriteLine("Root certificate import failed: " + ex.Message+" "+ex.ToString());
}
finally
{
store.Close();
}
}
Could not load file or assembly 'System.IO.Pipelines, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621) System.IO.FileLoadException: Could not load file or assembly 'System.IO.Pipelines, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)", "2021-03-28T07:41:12.715551Z stdout: File name: 'System.IO.Pipelines, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'", "2021-03-28T07:41:12.715557Z stdout: ---> System.IO.FileLoadException: Could not load file or assembly 'System.IO.Pipelines, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.", "2021-03-28T07:41:12.715562Z stdout: at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)", "2021-03-28T07:41:12.715567Z stdout: at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)", "2021-03-28T07:41:12.715572Z stdout: at System.Reflection.Assembly.LoadFrom(String assemblyFile)", "2021-03-28T07:41:12.715576Z stdout: at System.Reflection.Assembly.LoadFromResolveHandler(Object sender, ResolveEventArgs args)", "2021-03-28T07:41:12.715581Z stdout: at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)", "2021-03-28T07:41:12.715586Z stdout: at System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(RuntimeAssembly assembly, String assemblyFullName)", "2021-03-28T07:41:12.715590Z stdout: at StackExchange.Redis.ConnectionMultiplexer.Connect(ConfigurationOptions configuration, TextWriter log)",
Please try adding <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
to your project file, haven't tried yet, but going by solution posted here for a similar problem.
I solved the issue by downgrading StackExchange.Redis to a version that doesnt require Pipelines dependency.
User contributions licensed under CC BY-SA 3.0