Manjaro/Arch Linux下如何信任ASP.NET Core开发者证书?
Manjaro/Arch 下信任 ASP.NET Core 开发者 SSL 证书的正确步骤
针对你遇到的「ASP.NET Core developer certificate is not trusted」错误,以下是适配 Manjaro/Arch 系统的完整解决方案,修正了你原命令中的路径和参数问题:
步骤1:清理并重新生成开发者证书
先清理旧证书避免干扰,生成全新的HTTPS开发者证书:
# 清理旧的开发者证书 dotnet dev-certs https --clean # 生成新证书并尝试自动信任(Linux下此命令可能无效果,但仍建议执行) dotnet dev-certs https --trust # 将证书导出到dotnet默认的证书存储目录(规范路径) dotnet dev-certs https -ep ~/.aspnet/https/localhost.pem --format PEM
步骤2:配置系统级证书信任(适配wget/curl等工具)
Manjaro/Arch 使用 update-ca-trust 管理系统根证书,将证书放到标准信任锚目录:
# 复制证书到系统信任锚目录 sudo cp ~/.aspnet/https/localhost.pem /usr/share/ca-certificates/trust-source/anchors/aspnetcore-dev-cert.pem # 更新系统证书缓存 sudo update-ca-trust extract
步骤3:信任Chromium系浏览器(Chrome/Edge/Brave等)
这类浏览器使用NSS数据库存储证书,通过certutil添加信任:
# 将证书添加到用户NSS数据库,标记为完全信任(服务器、客户端、代码签名) certutil -d sql:$HOME/.pki/nssdb -A -t "P,C,C" -n "ASP.NET Core HTTPS Development Certificate" -i ~/.aspnet/https/localhost.pem
注意:如果提示
certutil未安装,执行sudo pacman -S nss安装工具包
步骤4:确保.NET跨进程调用信任证书
将证书链接到系统SSL证书目录,确保dotnet跨进程调用时能识别:
# 创建软链接到系统SSL证书目录 sudo ln -s /usr/share/ca-certificates/trust-source/anchors/aspnetcore-dev-cert.pem /etc/ssl/certs/aspnetcore-dev-cert.pem # 更新系统证书列表 sudo update-ca-certificates
验证解决方案
- 启动你的ASP.NET Core Web应用
- 使用浏览器访问
https://localhost:<你的端口>,确认不再出现证书不安全提示 - 用curl测试系统工具信任:
curl https://localhost:<你的端口>
内容的提问来源于stack exchange,提问作者Keith Jackson
相关产品推荐
相关产品推荐

