3

IIS6 svr2003 から IIS7.5 サーバー 2008r2 に移行し、URL 書き換えをインストールしました。それはすべてうまくいきます。問題の Web サイトは大規模で、.net 2 統合パイプラインで実行されています。現時点では、.net 4 でやり直すことはできません。私はこれにまったく慣れておらず、ここでの私の深さから少し外れています。書き換え機能を使いたいのですが、サブアプリも動作させる必要があります。どんな助けでも大歓迎です。

ただし、外部ベンダーのサブ仮想アプリには、webconfig の書き換えセクションに問題があります。コメントアウトすると、サブ仮想がうまく機能します。私はウェブを見て、いくつかのことを試しました:

<location path="." inheritInChildApplications="false">

また

<location path="." allowOverride="true" />

書き換えモジュールをラップすると、次のようになります。system.web要素には無効な子要素の場所があります。

サブ仮想アプリの 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>
4

1 に答える 1

0

最も簡単な方法は、ご想像のとおり、サブ アプリケーションでclearorを使用することです。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>

ただし、オンラインで見つけたように、locationブロックを使用してこれを行うこともできます。あなたが試したことの問題は、ロケーションブロックがブロックの内側ではなくブロックの外側にある必要があることです。system.webServer

あなたは試したことを書いています:

<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>
于 2013-04-30T23:57:29.540 に答える