asp.net-mvc - 路由配置 - 找不到资源错误 Asp.Net MVC
问题描述
1-我是 Createnew Project MVC Empty 并且我添加了新的控制器名称 Home :
public class Home : Controller
{
// GET: Home
public ActionResult Index()
{
return View();
}
}
2-我正在索引中移动并添加视图
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_MainLayout.cshtml";
}
<h2>Index</h2>
但是如果我正在调试我的项目,请告诉我 ASP MVC 路由配置 - 找不到资源错误信息:在 RouteConfig 我有这个方法
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
解决方案
推荐阅读
- cropperjs - 仅显示cropperjs 预览而不显示实际的cropper
- sql - 根据条件在 Bigquery 中选择最上面的行
- javascript - 如何获取并显示选定的值到
使用 ajax (codeigniter) 在我的编辑表单中添加标签 - amazon-web-services - 如何在 terraform 数据块中使用 !=
- javascript - 我的表单在提交后将页面重定向到表单上使用的 API url (action="some url"),如何解决这个问题?Django VanillaJS
- reactjs - react-google-maps 内容安全政策
- windows - 在 Windows 编程中将 GUID 定义为许多小片段的约定
- html - 下拉菜单在我打开时将背景向下移动
- html - 如何将图像并排放置到 2 列中,“溢出”到下一行
- android - Android 的 ConstraintLayout 中的 Horizonstal/Vertical Bias 值是否始终受到尊重?