Asp.net MVC Core 2.2始终位于/index.html而不是home / index

时间:2019-02-04 11:05:15

标签: asp.net-core-2.2

我的配置如下。

app.UseMvc(ConfigureRoutes);

使用ConfigureRoutes如下。

private void ConfigureRoutes(IRouteBuilder routeBuilder)
{
    routeBuilder.MapRoute("Default", "{Controller=Home}/{Action=Index}/{Id?}");
}

但是它总是可以到达/index.html。

因此,当我键入https://localhost:6001/时,它会转到https://localhost:6001/index.html。我希望保留https://localhost:6001/,但要在家庭控制器内部执行索引操作方法。

当然,当我键入完整的URL https://localhost:6001/home/index时,它可以正常工作。当我键入https://localhost:6001/home

时,它也可以正确执行索引操作方法

我想念什么。

请注意,HomeController和Index操作方法上没有属性。

0 个答案:

没有答案