开发者

MVC3 app ignoring Razor .cshtml extension

I am trying to run an MVC3 with Razor web project for the first time. The project was generated by S#arp Architecture, so there could be some wiring missing.

The de facto web.config with the Razor entries has been created under the Views folder. Here is the error for ~/

[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]
开发者_开发技巧

Any idea what's missing? Thanks.


Adding

ViewEngines.Engines.Add(new RazorViewEngine());

To

Application_Start()

in Global.asax.cs

Did the trick

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜