我正在开发一个 ASP.NET MVC3 应用程序。
在视图中,我创建了一个名为 Home 的文件夹和一个名为 Index 的视图。
然后我创建了一个控制器 HomeController。
在控制器中我添加了:
public ActionResult Index()
{
return View();
}
但是当我运行应用程序时,我得到了这个错误:
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /
如果我添加到地址栏:/Home/Index 视图会正常加载。
如何使应用程序在加载时自动转到主页/索引?
谢谢你的帮助