本文介绍了ASP.NET Core默认调试启动URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用ASP.NET Core Web API模板时,默认的调试启动URL被设置为api/values.该默认设置在哪里配置,以及如何更改?

When using the ASP.NET Core Web API template, the default debugging start up URL is somehow set to api/values. Where is this default configured and how do I change it?

推荐答案

关于该启动URL的声明位置,我几乎找不到文档.在博客文章.我最终在项目的Properties节点下的launchSettings.json文件中偶然发现了它,如下所示:

There was very little documentation that I could find regarding where this start up URL was declared. There is a brief mention of it in this blog post on MSDN. I eventually stumbled upon it in the launchSettings.json file under the Properties node of the project as shown below:

以下是此文件的内容:

{
  "profiles": {
    "IIS Express": {
      "commandName" : "IISExpress",
      "launchBrowser": true,
      "launchUrl": "api/values",
      "environmentVariables" : {
        "ASPNET_ENV": "Development"
      }
    }
  }
}

您可以将launchURL更改为所需的默认路由.

You can change the launchURL to your desired default route.

这篇关于ASP.NET Core默认调试启动URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 00:54
查看更多