You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Chrome拒绝自签名证书却认可.NET开发者证书的原因排查

ASP.NET Core MVC自签名证书在Chrome中无效,但.NET开发者证书正常的原因?

我尝试为ASP.NET Core MVC网站添加自签名证书,但Chrome浏览器提示“证书无效”,拒绝接受该证书。该自签名证书是通过PowerShell创建的,参考了官方的证书创建和导出文档指引。

自签名证书配置及报错情况

对应的appsettings.json配置如下:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*",
  "Kestrel": {
    "Endpoints": {
      "MyHttpEndpoint": {
        "Url": "http://localhost:5000"
      },
      "MyHttpsEndpoint": {
        "Url": "https://localhost:5001",
        "SslProtocols": [ "Tls12", "Tls13" ],
        "Certificate": {
          "Path": "mypfx.pfx",
          "Password": "1234"
        }
      }
    }
  }
}

Chrome浏览器报错截图:
Chrome提示证书无效

.NET开发者证书配置及正常情况

当我使用.NET开发者证书时,Chrome可正常接受网站的HTTPS连接,此时appsettings.json配置如下:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*",
  "Kestrel": {
    "Endpoints": {
      "MyHttpEndpoint": {
        "Url": "http://localhost:5000"
      },
      "MyHttpsEndpoint": {
        "Url": "https://localhost:5001",
      }
    }
  }
}

Chrome正常访问截图:
Chrome接受.NET开发者证书

请问出现这种差异的原因是什么?


内容的提问来源于stack exchange,提问作者yogihosting

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 18:15:00