我第一次尝试使用Razor web项目运行MVC3。该项目由S#arp Architecture生成,因此可能缺少一些布线。
在Views文件夹下创建了带有Razor条目的事实上的web.config。这是〜/
的错误[InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Index.aspx
~/Index.ascx
~/Views/Home/Index.aspx
~/Views/Home/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx]
知道缺少什么吗?感谢。
答案 0 :(得分:8)
添加
ViewEngines.Engines.Add(new RazorViewEngine());
到
Application_Start()
在Global.asax.cs
中诀窍