2011-10-11 2 views
8

ビューに小さなバグがあり、ビューエンジンが自分のカミソリだけでなくaspx/ascxページを検索していたことに気付きました。 (私の不具合は修正されました)MVC 3 Razor - ビューエンジンがaspxとascxのページを検索するのを止めるには?

Razorビューエンジンのみを検索する方法はありますか?ここで

が表示されたエラーメッセージです:

The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched: 
~/Areas/BO/Views/Organization/Index.aspx 
~/Areas/BO/Views/Organization/Index.ascx 
~/Areas/BO/Views/Shared/Index.aspx 
~/Areas/BO/Views/Shared/Index.ascx 
~/Views/Organization/Index.aspx 
~/Views/Organization/Index.ascx 
~/Views/Shared/Index.aspx 
~/Views/Shared/Index.ascx 
~/Areas/BO/Views/Organization/Index.cshtml 
~/Areas/BO/Views/Organization/Index.vbhtml 
~/Areas/BO/Views/Shared/Index.cshtml 
~/Areas/BO/Views/Shared/Index.vbhtml 
~/Views/Organization/Index.cshtml 
~/Views/Organization/Index.vbhtml 
~/Views/Shared/Index.cshtml 
~/Views/Shared/Index.vbhtml 

答えて

15

あなたはそれが唯一のRazorViewEngineが含まれるようにViewEngine.EnginesからWebFormsViewEngineを削除する必要があります。例えば

ViewEngines.Engines.Clear(); 
ViewEngines.Engines.Add(new RazorViewEngine()); 
+0

私はこれをapp_startに入れますか? – Arnej65

+0

はい。 – SLaks

+0

ありがとうございました。 (受け入れるまで9分) – Arnej65

関連する問題