MVC3应用程序忽略Razor .cshtml扩展名

jen*_*ent 7 asp.net asp.net-mvc-routing razor asp.net-mvc-3

我想第一次使用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]
Run Code Online (Sandbox Code Playgroud)

知道缺少什么吗?谢谢.

jen*_*ent 8

添加

ViewEngines.Engines.Add(new RazorViewEngine());
Run Code Online (Sandbox Code Playgroud)

Application_Start()
Run Code Online (Sandbox Code Playgroud)

在Global.asax.cs中

诀窍