ASP.NET Core 2.1 : 十三.httpClient.GetAsync 报SSL错误的问题

不知什么时候 ,出现了这样的一个奇怪问题,简单的httpclient.getasync("xxxx")居然报错了。(asp.net core 系列目录

一、问题描述

把原来的程序从2.0升级到2.1,突然发现原本正常运行的httpclient.getasync("xxxx")居然不工作了。

为了排除项目中其他引用的干扰,新建了一个干净的2.1的项目,main里直接调用

var client = new httpclient();
var task = client.getasync(url);

依然是报错。

错误信息如下:

system.aggregateexception: one or more errors occurred. (the ssl connection could not be established, see inner exception.) ---> system.net.http.httprequestexception: the ssl connection could not be established, see inner exception. --->
interop+crypto+opensslcryptographicexception: error:2006d002:bio routines:bio_new_file:system lib
   at interop.crypto.checkvalidopensslhandle(safehandle handle)
   at internal.cryptography.pal.storepal.loadmachinestores()
   at *****************************************

 

原本以为是升级runtime的时候出错了,重新安装后依然是这样。

系统环境:

os:centos 7

host (useful for support):
  version: 2.1.2
  commit:  811c3ce6c0

.net core runtimes installed:
  microsoft.aspnetcore.all 2.1.2 [/usr/share/dotnet/shared/microsoft.aspnetcore.all]
  microsoft.aspnetcore.app 2.1.2 [/usr/share/dotnet/shared/microsoft.aspnetcore.app]
  microsoft.netcore.app 2.1.2 [/usr/share/dotnet/shared/microsoft.netcore.app]

 

偶然发现,通过dotnet命令运行对应的dll可以正常运行:

dotnet  ......xx/xx/test.dll

但通过 /etc/systemd/system/kestrel-test.service 这样的服务启动的情况下依然报错。

每次都通过dotnet命令运行肯定是不合适的,继续想办法。

 

二、解决方法

这是因为在 /etc/ssl/certs 目录下存在没有读取权限或者已损坏的文件导致的,查看一下这个文件夹确实最近几天有新文件写入,可能是最近安装什么进来的吧。

没有一个个的试验,临时把这个文件夹的公共权限设置了可读,可以正常运行了,算是个临时方法吧,这样开权限肯定不是一个好办法,

据说在新版本中会修复, 重新刷了一下 yum update 也没有新的,官网看看也还没2.1.3的runtime。希望新版本中 早点把这个问题修复。

 

本文链接:https://2i3i.com/aspnetcore2_13.html ,转载请注明来源地址。
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇