url-rewriting - 我如何知道安装了哪个版本的 IIS7 URL 重写模块

标签 url-rewriting iis-7

我在 IIS7 中创建了一个重写规则,该规则使用条件元素中的 trackAllCaptures="false"属性并使用 outboundRules。在我的测试系统上一切正常,但是当我将这些规则部署到 GoDaddy 时,我收到错误:

Unrecognized attribute 'trackAllCaptures' 

如果我包含 outboundRules 节点,我会从服务器收到 500 错误。我与他们的支持人员进行了交谈,他们坚持认为他们支持 2.0 版本的 URL 重写模块。我的问题是如何验证或与他们沟通如何检查此模块的版本?除了尝试安装它以检查版本之外,我找不到其他方法。

我正在尝试重写 ASP.Net 应用程序(而不是 WordPress)的 URL,以便从 URL 中删除子文件夹,这是多域托管中非常普遍的问题。我正在使用的示例位于此处:http://weblogs.asp.net/owscott/archive/2010/05/26/url-rewrite-multiple-domains-under-one-site-part-ii.aspx

最佳答案

URL 重写的二进制文件位于:

%SystemRoot%\system32\inetsrv\rewrite.dll

Url Rewrite 1.1 has a File Version of 7.1.490.43.
Url Rewrite 2.0 has a File Version of 7.1.761.0 or 7.1.871.0 (there may be others but these are the two different versions I know of).

If you don't have console access to verify the version number try running the following code in a simple web page:

Assembly a = Assembly.Load("Microsoft.Web.Iis.Rewrite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
Response.Write(a.FullName);

如果安装了 UrlRewrite 2.0,那么您将看到类似以下内容:

Microsoft.Web.Iis.Rewrite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

如果不是,那么您将抛出异常:

Could not load file or assembly 'Microsoft.Web.Iis.Rewrite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

您还可以将他们指向此文档页面:

Tracking Capture Groups Across Conditions

这一段非常清楚地表明trackAllCaptures是 2.0 特定设置,如果它不起作用,则肯定未安装 2.0:

In URL Rewrite Module 2.0, it is possible to change how capture groups are indexed. Enabling trackAllCaptures setting to on the <conditions> collection makes the capture groups form all matched conditions to be available through the back-references.

关于url-rewriting - 我如何知道安装了哪个版本的 IIS7 URL 重写模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11813006/

相关文章:

url - PrestaShop $link -> getProductLink($product) 给出了错误的 URL

.htaccess - htaccess 重写会破坏相对路径

asp.net - 如何调试UrlRewriter.NET?

asp.net - 如何判断 IIS 应用程序池被回收的原因

iis-7 - IIS7 中的多个 rewriteMaps,只有一个响应

php - 根据数据库中的表检查 url

apache - 301重定向文件夹根目录

asp.net-mvc-3 - IIS 全局化和西类牙语(拉丁美洲)es-419

c# - 将凭据传递给 ASP.NET 4.0 和 IIS7 中的 File.Move()

asp.net - 发生403错误时如何阻止IIS 7.0重定向到自己的页面