MVC在找不到頁面的時候,會先找aspx、ascx...最後才會尋找cshtml
可以在Global.asax中加幾行程式,讓他先搜尋cshtml,可以加快搜尋速度
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
ViewEngines.Engines.Add(new WebFormViewEngine());
找不到檢視 'Index' 或其主版,或沒有任何檢視引擎支援搜尋的位置。已搜尋過下列位置:
~/Views/Home/_LayoutSample.cshtml
~/Views/Home/_LayoutSample.vbhtml
~/Views/Shared/_LayoutSample.cshtml
~/Views/Shared/_LayoutSample.vbhtml
~/Views/Home/Index.aspx
~/Views/Home/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Home/_LayoutSample.master
~/Views/Shared/_LayoutSample.master
沒有留言:
張貼留言