简体   繁体   English

ASP.NET Core MVC相当于Start Action Specific Page

[英]ASP.NET Core MVC equivalent of Start Action Specific Page

In ASP.NET Webforms or ASP.NET MVC projects, I can select the page/route that is being called in the browser when I press F5 for debugging, as shown in the screenshot below. ASP.NET WebformsASP.NET MVC项目中,当我按F5进行调试时,我可以选择浏览器中调用的页面/路由,如下面的屏幕截图所示。

具体页面设置

What is the equivalent in ASP.NET Core MVC ? ASP.NET Core MVC的等价物是什么? I'm using IIS Express with SSL for local debugging. 我正在使用带有SSL IIS Express进行本地调试。 In the launchSettings.json I have an applicationUrl defined as this: launchSettings.json我有一个applicationUrl定义如下:

"iisExpress": {
  "applicationUrl": "http://localhost:59563/",
  "sslPort": 44333
}

When I start debugging, https://localhost:44333 is called. 当我开始调试时,调用https://localhost:44333 My goal is to that https://localhost:44333/MYROUTE is beging called upon starting the debug mode. 我的目标是在启动调试模式时调用https://localhost:44333/MYROUTE

Where can I specify that I want https://localhost:44333/MYROUTE to be my start URL for debugging? 我在哪里可以指定我想要https://localhost:44333/MYROUTE作为调试的起始URL?

Use the launchUrl setting with a relative url: launchUrl设置与相对url一起使用:

"launchUrl": "Home/About",

You can also set this from the project properties in Visual Studio: 您还可以从Visual Studio中的项目属性中进行设置:

在此输入图像描述

This will start the browser with the specificed relative url: 这将使用指定的相对URL启动浏览器:

在此输入图像描述

You can change the launchsettings.json (in Visual Studio usually shown when you expand the "Properties"-Node in the solution explorer. There you can set the launchUrl in the according launch profile: 您可以更改launchsettings.json(在Visual Studio中,通常在解决方案资源管理器中展开“属性”-Node时显示。在那里,您可以在相应的启动配置文件中设置launchUrl:

{
  "iisSettings": {
    "iisExpress": {
      "applicationUrl": "http://localhost:59563/",
     "sslPort": 44333
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
     "launchUrl": "https://localhost:44333/YOURROUTE"
    }
}

You can select the launch profile using the small black arrow next to the debug-button: 您可以使用调试按钮旁边的黑色小箭头选择启动配置文件: 设置启动配置文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM