我如何使脚手架页面成为第一页
因此,我正在关注 ASP.NET 的入门教程。到目前为止一切顺利,但是转到 /controllerName
相当乏味。有没有办法在项目启动时转到该索引页面?我在演练或任何文档中找不到它。我使用的是 6.0 版本。我对这个基本问题感到抱歉。
So I'm following the get started tutorial on ASP.NET . So far so good, however going to /controllerName
is quite tedious. Is there a way how I can go to that index page on start up of the project? I couldn't find it in the walkthrough or any documentation. I'm using version 6.0 . I'm sorry for this basic question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
.NET MVC 具有可以覆盖的内置默认值。
从根 / 路由的默认起始页是主控制器上的索引操作:
坚持这些默认值是一个好主意,这样其他开发人员会发现更容易理解您的项目。
但是,如果您愿意,可以在 Startup.cs 配置方法中覆盖 .NET 5.0 中的默认值:
.NET MVC has built in defaults that can be overriden.
The default start page which will be routed from the root / is the Index action on the home controller:
Sticking to these defaults is a good idea so other developers will find it easier to make sense of your project.
But you can override the defaults in .NET 5.0 if you wish in the Startup.cs Configure method:
您可以从路线配置更改所需的起始页面。它在
应用程序_启动>路由配置
路由配置
您可以根据需要更改控制器名称和索引页面。
You can change the desired starting page from Route config. It's in
App_Start>RouteConfig
route config
You can change it controller name and index page as you want.