MVC中路由也没错,控制器也没错,视图也有为什么提示页面不存在
- C# code
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); }路由为Home/Index
- C# code
public class HomeController : Controller { // // GET: /Home/ public ActionResult Index() { return View(); } public ActionResult Index2() { return View(); } public ActionResult Index3() { return View(); } }控制器也存在
视图也有,为什么运行时候,找不到页面
[解决办法]
你的问题条件太少,能够想到的有两点:
1、HomeController所在的dll没有在bin目录下。
2、iis没有配置好,也就是找不到Home/Index的路径
[解决办法]
浏览器正确的浏览路径类似这样 http://localhost:2131/Home/Index
[解决办法]
看看页面文件是不是在views文件夹下面的home文件夹内
页面文件名字一定是Index.cshtml,Index2.cshtml,Index3.cshtml
[解决办法]