我不知道爲什麼這個錯誤發生在調試項目後,即使代碼是默認的。無法找到該資源。 ASP.NET MVC3
控制器
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
return View();
}
}
查看
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>Index</title>
</head>
<body>
<div>
Hi
</div>
</body>
莫名其妙或更確切地說,調試完畢後,請求的URL總是/Views/Home/Index.cshtml但通過瀏覽器訪問主頁的罰款。 (http:// localhost:58323/home)
我用Google搜索了一下,並提示問題出在全局。但那很奇怪,我不記得做任何改變。
全球
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
);
}
得到任何幫助。謝謝
Omg,你是一個救星!非常感謝@Matt Murphy – aHaH 2012-01-12 03:52:32
嗨,我也遇到同樣的問題,但是當我改變它使用一個開始URL,然後保存我得到了一個錯誤消息「在無效指定的起始URL」 – 2012-12-04 12:40:42