【发布时间】:2018-07-08 09:59:04
【问题描述】:
我正在学习有关 Core MVC 的教程,但遇到了我无法穿透的墙。
- 我有一个
index.html文件 - 我已将 index.html 文件复制到
Views/Home/index.cshtml - 在 cshtml 文件中我添加了一个简单的 Razor 代码:
@DateTime.Now.Year - 已保存、运行的应用程序,默认页面显示类似于
index.html的代码。/home运行 cshtml 文件。 - 不知道为什么,删除了
index.html - 还是一样,默认页面显示类似于
index.html,/home显示index.cshtml,尽管index.html甚至不再是在解决方案中。
我的家庭控制器:
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
}
在我的启动文件中:
app.UseMvc(routes =>
{
routes.MapRoute("default",
"{controller=Home}/{action=Index}/{id?}");
});
【问题讨论】:
-
不清楚你在问什么。你期望发生什么?
-
我正在尝试显示一个包含 cshtml 文件的视图,但它一直显示我已从解决方案中删除的 html 文件。
-
index.html 是否仍然存在于同一路径中?也许这就是正在提供的东西?
标签: c# asp.net-core asp.net-core-mvc