我可以改变搜索顺序一个ASP.Net MVC 3应用程序的物理视图 [英] Can I change the search order for the physical views of an ASP.Net MVC 3 application

查看:108
本文介绍了我可以改变搜索顺序一个ASP.Net MVC 3应用程序的物理视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到Asp.net MVC的.aspx文件3搜索之前.cshtml文件。我可以改变这个搜索顺序?而如何做到这一点?

I noticed Asp.net MVC 3 searches for .aspx files before .cshtml files. Can I change this search order? And how to do this?

在调试,我得到了以下异常:

When debugging I got the following exception:

The view 'Reset' or its master was not found. The following locations were searched:
~/Views/Demo/Reset.aspx
~/Views/Demo/Reset.ascx
~/Views/Shared/Reset.aspx
~/Views/Shared/Reset.ascx
~/Views/Demo/Reset.cshtml
~/Views/Demo/Reset.vbhtml
~/Views/Shared/Reset.cshtml
~/Views/Shared/Reset.vbhtml

我由此得出结论,旧的.aspx视图搜索第一位。

I conclude from this, that the old .aspx views are searched for first.

由于我转换我的网站MVC3,和所有的意见剃刀,我想.cshtml文件被首先搜索。我认为这将是更好的性能。

Since I converted my site to MVC3, and all views to Razor, I would like the .cshtml files to be searched first. I think this would be better for performance.

推荐答案

是的。 <一href=\"http://blogs.msdn.com/b/marcinon/archive/2010/11/14/mvc-areas-and-multiple-view-engines.aspx?wa=wsignin1.0\">Change现有的视图引擎的顺序。的。

但是,在一个非调试配置,文件位置缓存,所以它只会在第一次查找帮助。我不会出汗。

But in a non-debug configuration, file locations are cached, so it will only help on the first lookup. I wouldn't sweat it.

这篇关于我可以改变搜索顺序一个ASP.Net MVC 3应用程序的物理视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆