2012-03-20 21 views
1

即時通訊不知道我搞砸了,但我只是不斷收到f5以下錯誤。'/'應用程序中的服務器錯誤MVC3

無法找到該資源。

說明:HTTP 404.您正在查找的資源(或其某個依賴項)可能已被刪除,名稱已更改或暫時不可用。請檢查以下網址並確保它拼寫正確。

請求的網址:/

以下是我的路線,完全默認,沒有更改。

 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 
     ); 

    } 

我檢查了我的項目屬性 - > web選項卡,「特定頁面」有第n個。我的項目有索引頁面的主文件夾。

其他網頁只有在手動輸入網址後才能使用。對於如:http://localhost:21183/store/search

感謝

+0

你說你有視圖(索引頁主文件夾),但你不小心刪除了您的HomeController的Index方法? – Rupo 2012-03-20 08:43:27

回答

3

檢查事項:

  1. 您有一個名爲HomeController一個公共類從Controller派生。
  2. 這個HomeController類有一個公開的索引操作。
  3. 你有相應的視圖~/Views/Home/Index.cshtml
  4. 你正在測試這個內置的web服務器,它支持不擴展的網址。例如,這在IIS 6.0中無法使用。

控制器:

public class HomeController: Controller 
{ 
    public ActionResult Index() 
    { 
     return View(); 
    } 
} 
+0

夥計,你的救星,謝謝你總是救我的屁股。 – aHaH 2012-03-20 08:52:10

相關問題