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

运行.NET Aspire启动应用时遇applicationUrl配置错误求助

解决.NET Aspire启动时的applicationUrl非HTTPS错误

错误信息:

One or more errors occurred. (The 'applicationUrl' setting must be an https address unless the 'ASPIRE_ALLOW_UNSECURED_TRANSPORT' environment variable is set to true. This configuration is commonly set in the launch profile.)

错误截图

两种解决办法:

1. 将applicationUrl改为HTTPS地址

找到项目下Properties/launchSettings.json文件,修改对应启动配置里的applicationUrl字段,确保包含HTTPS地址。示例:

"profiles": {
  "YourAppName": {
    "commandName": "Project",
    "dotnetRunMessages": true,
    "launchBrowser": true,
    "applicationUrl": "https://localhost:5001;http://localhost:5000",
    "environmentVariables": {
      "ASPNETCORE_ENVIRONMENT": "Development"
    }
  }
}

如果不需要HTTP地址,直接只保留HTTPS地址即可。

2. 设置ASPIRE_ALLOW_UNSECURED_TRANSPORT环境变量为true

  • 临时设置(当前终端生效):
    • Windows命令行:
      set ASPIRE_ALLOW_UNSECURED_TRANSPORT=true
      
    • PowerShell:
      $Env:ASPIRE_ALLOW_UNSECURED_TRANSPORT = "true"
      
  • 持久化到启动配置:
    在launchSettings.json的对应启动配置里,添加环境变量:
    "profiles": {
      "YourAppName": {
        // 其他配置...
        "environmentVariables": {
          "ASPNETCORE_ENVIRONMENT": "Development",
          "ASPIRE_ALLOW_UNSECURED_TRANSPORT": "true"
        }
      }
    }
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.23 15:47:04