Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 812
jenson-button-event Avatar asked Mar 01 '11 11:03

jenson-button-event


1 Answers

Adding

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

To

Application_Start()

in Global.asax.cs

Did the trick

like image 102
jenson-button-event Avatar answered Nov 08 '22 03:11

jenson-button-event