几天来,我一直在尝试从ibmcloud函数连接到ibmcloud的redis实例的IBM数据库,但一直没有成功。我尝试使用ibmcloud支持的版本.netcore 2.2和docker image core 3.1。
我可以使用以下代码从本地控制台应用程序连接到redis,而不会出现任何错误。
我需要你的帮助。谢谢。
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();
}
}无法加载文件或程序集'System.IO.Pipelines,Version=5.0.0.0,Culture=neutral,PublicKeyToken=cc7b13ffcd2ddd51‘。找不到或无法加载特定文件。(0x80131621) System.IO.FileLoadException:未能加载文件或程序集'System.IO.Pipelines,Version=5.0.0.0,Culture=neutral,PublicKeyToken=cc7b13ffcd2ddd51‘。找不到或无法加载特定文件。(0x80131621)","2021-03-28T07:41:12.715551Z标准输出:文件名:'System.IO.Pipelines,Version=5.0.0.0,Culture=neutral,PublicKeyToken=cc7b13ffcd2ddd51'","2021-03-28T07:41:12.715557Z标准输出:-> System.IO.FileLoadException:无法加载文件或程序集'System.IO.Pipelines,Version=5.0.0.0,Culture=neutral,PublicKeyToken=c7b13ffcd2ddd51‘.“,"2021-03-28T07:41:12.715562Z标准输出: at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext,字符串发送器,字符串发送器,字符串发送器)“,"2021-03-28T07:41:12.715567Z stdout: at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String ilPath )”,"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 retAssembly,ResolveEventArgs args)","2021-03-28T07:41:12.715581Z标准输出: at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler配置,字符串名称)“,"2021-03-28T07:41:12.715586Z标准输出: at System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(RuntimeAssembly程序集,字符串assemblyFullName)","2021-03-28T07:41:12.715590Z标准输出: at StackExchange.Redis.ConnectionMultiplexer.Connect(ConfigurationOptions eventHandler,TextWriter日志)”,
发布于 2021-03-28 16:03:53
请尝试将<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>添加到您的项目文件,还没有尝试,但使用解决方案发布了类似问题的here。
发布于 2021-03-28 22:42:34
我通过将StackExchange.Redis降级到一个不需要管道依赖的版本来解决这个问题。
https://stackoverflow.com/questions/66839366
复制相似问题