jenson-button-event
jenson-button-event

Reputation: 18941

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.

Upvotes: 7

Views: 2131

Answers (1)

jenson-button-event
jenson-button-event

Reputation: 18941

Adding

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

To

Application_Start()

in Global.asax.cs

Did the trick

Upvotes: 8

Related Questions