。net core LaunchSettings json在项目名称中设置为生产模式,但以开发模式输入

问题描述 投票:0回答:1

我在.net核心中遇到LaunchSettings.json的问题。我在配置文件中将我的APP设置为生产模式,但是它进入了开发模式。如果我将第一个IIS Express更改为生产,那么它将进入生产模式。为什么会这样?

在这里您可以找到我的json文件的摘要。

{
  "$schema": "http://json.schemastore.org/launchsettings.json",
  "iisSettings": {
    "windowsAuthentication": false, 
    "anonymousAuthentication": true, 
    "iisExpress": {
      "applicationUrl": "http://localhost:34527",
      "sslPort": 44378
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": false,
      "launchUrl": "api/values",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "DatingApp.API": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "api/values",
      "applicationUrl": "http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Production"
      }
    }
  }
}
asp.net-core asp.net-web-api .net-core asp.net-core-webapi production-environment
1个回答
1
投票

运行该应用程序时,您需要在下拉菜单中选择正确的配置文件。

enter image description here

如果要使用DatingApp.API配置文件运行该应用程序,则需要手动进行更改。

© www.soinside.com 2019 - 2024. All rights reserved.