Url rewriting iis7.5重写子虚拟应用程序的500.52
我刚刚从IIS6 svr2003迁移到IIS7.5 server 2008r2,并安装了url重写。这一切都很好。该网站很大,在.NET2集成管道下运行。此时无法在.net 4中重做。我对这件事是全新的,有点不了解。我真的很想使用重写功能,但我需要的子应用程序也工作。任何帮助都将不胜感激 但是,来自外部供应商的子虚拟应用程序在webconfig的重写部分有问题。我对它进行了评论,子虚拟的效果非常好。我在网上搜索并尝试了一些方法:Url rewriting iis7.5重写子虚拟应用程序的500.52,url-rewriting,iis-7.5,subapplication,Url Rewriting,Iis 7.5,Subapplication,我刚刚从IIS6 svr2003迁移到IIS7.5 server 2008r2,并安装了url重写。这一切都很好。该网站很大,在.NET2集成管道下运行。此时无法在.net 4中重做。我对这件事是全新的,有点不了解。我真的很想使用重写功能,但我需要的子应用程序也工作。任何帮助都将不胜感激 但是,来自外部供应商的子虚拟应用程序在webconfig的重写部分有问题。我对它进行了评论,子虚拟的效果非常好。我在网上搜索并尝试了一些方法: <location path="." inheritInCh
<location path="." inheritInChildApplications="false">
或
围绕重写模块包装:system.web元素具有无效的子元素位置
我试过了
在sub-virtual应用程序的webconfig中的system.web下,但即使将重写注释掉,也会出现错误。
我可以尝试删除,但不知道是否有人可以给我一些关于这个问题的见解
以下是基本的重写:
<rewrite>
<rules>
<rule name="RedirectUserFriendlyURL1" stopProcessing="true">
<match url="^sethsBrochure.pdf$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
</conditions>
<action type="Redirect" url="path/path/doc.pdf" appendQueryString="false" />
</rule>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^sethsBrochure$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="path/path/doc.pdf" />
</rule>
</rules>
<outboundRules>
<rule name="OutboundRewriteUserFriendlyURL1" preCondition="ResponseIsHtml1">
<match filterByTags="A, Form, Img" pattern="^(.*)path/path/doc\.pdf$" />
<action type="Rewrite" value="{R:1}/ path/path/doc" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
正如您所猜测的,最简单的方法是在子应用程序中使用
clear
或remove
。例如:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<!-- Insert rules for this application (if any) **below** the "clear" -->
</rules>
</rewrite>
</system.webServer>
</configuration>
相反,您需要这样做:
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<rewrite>
...
</rewrite>
<system.webServer>
</location>
<configuration>
...
<configuration>
<system.webServer>
<location path="." inheritInChildApplications="false">
<rewrite>
...
</rewrite>
</location>
<system.webServer>
<configuration>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<rewrite>
...
</rewrite>
<system.webServer>
</location>
<configuration>