2011-11-16 3 views
0

私は今夜、this guideを使用して、既存のASP.NET webformアプリケーションをMVC3に変換しました。エラーをスローし、global.asaxでブレークポイントに当たらないASP.NET MVC3アプリケーションをデバッグするには?

Server Error in '/' Application. 

The resource cannot be found. 

Description: HTTP 404. The resource you are looking for (or one of its 
dependencies) could have been removed, had its name changed, or is 
temporarily unavailable. Please review the following URL and make sure 
that it is spelled correctly. 

Requested URL:/

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET  Version:4.0.30319.237 

私は私の疑いとして、私のGlobal.asaxで様々なブレークポイントを設定しようとしました:私はちょうど私の仕事をチェックするためにローカルでアプリケーションを実行するアプリを起動するために行くときしかし、私はこのエラーを取得していますルーティングと何かをねじ込んだが、ブレークポイントはまったくヒットしません。このファイルの中で私のブレークポイントに当たっていないので、私の前提は、コントローラまたはビューの両方を見る必要がないということです。

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.Mvc; 

namespace www.Controllers 
{ 
    public class HomeController : Controller 
    { 
     public ActionResult Index() 
     { 
      return View(); 
     } 

    } 
} 
:コントローラ\ HomeController.cs \

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.Mvc; 
using System.Web.Routing; 

namespace www 
{ 
    public class MvcApplication : System.Web.HttpApplication 
    { 
     public static void RegisterGlobalFilters(GlobalFilterCollection filters) 
     { 
      filters.Add(new HandleErrorAttribute()); 
     } 

     public static void RegisterRoutes(RouteCollection routes) 
     { 
      routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 

      //ignore aspx pages (web forms take care of these) 
      routes.IgnoreRoute("{resource}.aspx/{*pathInfo}"); 

      routes.MapRoute(
       "Default", // Route name 
       "{controller}/{action}", // URL with parameters 
       // Parameter defaults 
       new { controller = "Home", action = "Index"} 
       ); 
     } 

     protected void Application_Start() 
     { 
      AreaRegistration.RegisterAllAreas(); 

      RegisterGlobalFilters(GlobalFilters.Filters); 
      RegisterRoutes(RouteTable.Routes); 
     } 
    } 
} 

マイフォルダ構造は、以下のフォルダとファイルが含まれています。

Controllers\ 
    HomeController.cs 
Models\ 
Views\ 
    Home\ 
     Index.cshtml 
    Shared\ 
     _Layout.cshtml 
     Error.cshtml 
    _ViewStart.html 
    Global.asax 
    web.config 
web.config 

ここでのGlobal.asaxの内容です

私はASP.NET MVCとVisual Studioには比較的新しいので、どこでデバッグを開始するのかはわかりませんs。任意のヒントをいただければ幸いです。

+0

「global.asax」が名前空間に「www」という名前が付けられています。どうやって??? –

+0

プロジェクトの名前は "www"です。 – TMC

+0

ビンが正しいディレクトリにありますか? Ifso、すべてのDLLが展開されていますか? – Peter

答えて

0

Mystere Manの返信に基づいて、答えはglobal.asaxが間違って\ Views \フォルダの下に置かれ、ルートには置かれないということでした。私がそれを動かすと、すべてが順調でした。

関連する問題