开发者

Problems with default Razor View when deploying to "real" IIs Web Site

I have this ASP.NET MVC 3 application that works fine when developing locally using IIs Express 7.5 or Cassini.

But when i deploy the app to a real web site on IIs 7.5 (even on my local dev box) I get the dreaded

The view 'Index' or its master was not found or no view engine supports the s开发者_开发问答earched locations.

The following locations were searched:

~/Views/Home/Index.cshtml

~/Views/Home/Index.vbhtml

~/Views/Shared/Index.cshtml

~/Views/Shared/Index.vbhtml

I have tried the following: In global.asax.cs, added these lines in the Application_Start() method to force it to use the Razor view engine only:

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

But to no avail.

I find this error message somewhat difficult to troubleshoot. Can someone give me some pointers on what to look for?


Ok, my bad.

A classic example of shooting first then ask. (Or the other way around...)

The Home/Index.cshtml file had its Build Actions set to None for some reason. Setting it to Content solved the problem.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜