1

我正在尝试拥有一个与 Index.cshtml 不同的主页

http(s)://localhost:5000==> 目前对应http(s)://localhost:5000/Index

在互联网上发现围绕相同概念的变体:

在 Startup.Configure 从这里改变

app.UseMvc();

对此

app.UseMvc(routes =>
{
   routes.MapRoute("default", "{controller=Home}/{action=Viewer}");
});

顺便说一句:Home 控制器在哪里?是隐含的吗?

4

1 回答 1

0

我使用 .Net core 3.1 并在启动文件中使用它

app.UseEndpoints(endpoints =>
            {
                endpoints.MapRazorPages();
                endpoints.MapControllerRoute("default", " 
{controller=Home}/{action=Viewer}/{id?}");});
于 2019-12-08T14:44:56.473 回答