性能重写规则与 routes.maproute
performance rewrite rules vs routes.maproute
我正在帮助客户升级 Web 应用程序,这包括一项需要将 100 个过时书签路由到新 url 的任务。
在查看以下链接时,我似乎很清楚我应该更新路由 table 而不是在 web.config 中放入重写规则来处理过时的书签:
When to use routes vs. rewrite rules?
http://www.iis.net/learn/extensions/url-rewrite-module/iis-url-rewriting-and-aspnet-routing
从好奇的角度来看,与 routes.maproute 中直接处理映射的条目相反,在 web.config 中有 100 - 250 条重写规则会影响 material 性能?对吗?
无论哪种方式,所有规则都需要在任何实际路由被命中之前执行。因此,用于这两种方法的性能量将是相似的。
I suspect that the IIS rewrite module will be slightly faster because it happens before .NET even becomes involved in the request. However, the actual performance will depend on whether you use partial URL matches (fastest) vs case-sensitive complete URL matches (fast) vs case-insensitive complete URL matches (not-so-fast) vs using regular expressions (slow). Note that not all of these options are available in IIS rewrite.
此外,从维护的角度来看,使用 IIS 重写比为 过时 URL 映射路由更有意义。然后,您可以将这些旧 URL 保留在您的应用程序配置之外。
唯一的例外是,如果您想处理浏览器不遵守 HTTP 301 的用户边缘情况,并且您希望 确保用户知道更新后的 URL 并更新他们的书签。 IIS 重写模块仅发送 301 响应并假定客户端会遵守它(情况并非总是如此)。
我正在帮助客户升级 Web 应用程序,这包括一项需要将 100 个过时书签路由到新 url 的任务。
在查看以下链接时,我似乎很清楚我应该更新路由 table 而不是在 web.config 中放入重写规则来处理过时的书签:
When to use routes vs. rewrite rules?
http://www.iis.net/learn/extensions/url-rewrite-module/iis-url-rewriting-and-aspnet-routing
从好奇的角度来看,与 routes.maproute 中直接处理映射的条目相反,在 web.config 中有 100 - 250 条重写规则会影响 material 性能?对吗?
无论哪种方式,所有规则都需要在任何实际路由被命中之前执行。因此,用于这两种方法的性能量将是相似的。
I suspect that the IIS rewrite module will be slightly faster because it happens before .NET even becomes involved in the request. However, the actual performance will depend on whether you use partial URL matches (fastest) vs case-sensitive complete URL matches (fast) vs case-insensitive complete URL matches (not-so-fast) vs using regular expressions (slow). Note that not all of these options are available in IIS rewrite.
此外,从维护的角度来看,使用 IIS 重写比为 过时 URL 映射路由更有意义。然后,您可以将这些旧 URL 保留在您的应用程序配置之外。
唯一的例外是,如果您想处理浏览器不遵守 HTTP 301 的用户边缘情况,并且您希望