You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

ASP.NET Core 8 MVC部署至Windows Server IIS后默认启动URL未生效的问题咨询

ASP.NET Core 8 MVC部署至Windows Server IIS后默认启动URL未生效的问题咨询

嗨,各位开发者好,我最近碰到一个头疼的问题,想请大家帮忙分析下:

我在ASP.NET Core 8 MVC项目里,已经在launchSettings.json中配置了launchUrl,本地开发的时候完全正常——启动应用后会自动跳转到指定的http://localhost:20395/Auth/Login路径。但把项目部署到Windows Server的IIS上之后,打开应用却只会显示http://localhost/MyAppName,不会自动跳转到Auth/Login,这和我预期的完全不一样。

我想知道出现这种情况的原因是什么?有没有办法配置IIS让它使用正确的启动URL呢?

附上我的launchSettings.json配置:

{
  "profiles": {
    "http": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "launchUrl": "Auth/Login",
      "dotnetRunMessages": true,
      "applicationUrl": "http://localhost:5298"
    },
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "Auth/Login",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "ASPNETCORE_HOTRELOAD_MAXRULES": "15000"
      }
    },
    "WSL": {
      "commandName": "WSL2",
      "launchBrowser": true,
      "launchUrl": "http://localhost:5298",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "ASPNETCORE_URLS": "http://localhost:5298"
      },
      "distributionName": ""
    }
  },
  "$schema": "http://json.schemastore.org/launchsettings.json",
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:20395",
      "sslPort": 0
    }
  }
}

备注:内容来源于stack exchange,提问作者Midlaj

火山引擎 最新活动