ASP.net MVC路由抛出异常作为普通水煤浆? [英] ASP.net MVC Routing Throws Exceptions as Normal Behavour?

查看:140
本文介绍了ASP.net MVC路由抛出异常作为普通水煤浆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我调试我当前的项目(ASP.net MVC 1.0项目)
和偶然稍微打扰水煤浆。

I was debugging my current project (ASP.net MVC 1.0 project) and stumbled upon slightly disturbing behavour.

看来,当路由器是狩猎引用的局部视图
又名

It seems that when the router is hunting for a referenced partial view aka

<%Html.RenderPartial("AccountListControl", ViewData["AccountList"]); %>

这循环通过它的默认位置,直到找到正确的位置。
因此,它会检查视图\\共享\\ AccountListControl
并检查视图\\首页\\ AccountListControl
等等

It cycles through it's default locations until it finds the correct spot. So it checks "Views\Shared\AccountListControl" and checks "Views\Home\AccountListControl" etc

一旦它找到一个匹配 - 一切都很好。
糟糕的位置由在每种情况下抛出的异常的网络标识。

Once it finds a match - all is good. Bad locations are identified by the web exception thrown in each case.

是否有这些异常的显著性能成本?

我应该修改code更明确?

Should I modify the code to be more explicit?

推荐答案

这似乎在释放模式有<一个href=\"http://blog.dynatrace.com/2009/04/23/aspnet-mvc-htmlhelperrenderpartial-caches-resolved-names-in-release-mode/\"相对=nofollow>也不例外抛出视图位置缓存所以没有必要更明确。

It seems that in Release mode there are no exceptions thrown and view locations are cached so there is no need to be more explicit.

这篇关于ASP.net MVC路由抛出异常作为普通水煤浆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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