2012-01-12 16 views
2

私はSSL証明書を持っており、すべてのトラフィックをhttpsに向けるためにweb.config内に書き換えルールを設定しています。これはうまくいきます(誰かがそれを見つけた場合は以下のコード)が、私は今私の電話クライアントに公開しているサービスを持っていますが、私はHTTPSを使用したくありません。ASP.NET web.configのSSLルール例外

例外を作成することはできますか?だから、www.mydomain.com/PhoneService/Seek.svcのための任意の要求がhttps://www.mydomain.comにリダイレクトされていない.....

<rewrite> 
     <rules> 
      <rule name="HTTP to HTTPS redirect" stopProcessing="true"> 
       <match url="(.*)" /> 
       <conditions> 
        <add input="{HTTPS}" pattern="off" ignoreCase="true" /> 
       </conditions> 
       <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /> 
      </rule> 
     </rules> 
    </rewrite> 

答えて

3

あなたはパスが終わらないことを確実にするために、あなたのルールに別の条件を使用することができます

<rules> 
    <rule name="HTTP to HTTPS redirect" stopProcessing="true"> 
     <match url="(.*)" /> 
     <conditions> 
     <add input="{HTTPS}" pattern="off" /> 
     <add input="{URL}" pattern="seek\.svc$" ignoreCase="true" negate="true" /> 
     </conditions> 
     <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /> 
    </rule> 
</rules> 

ライン:seek.svc

<add input="{URL}" pattern="seek\.svc$" ignoreCase="true" negate="true" /> 

チェックURL変数とseek.svcで終わります。 と一致しない場合にルールを適用したいだけなので、条件を否定します。

+0

注:{PATH_INFO}から{URL}に[それはもっと正確です](http://msdn.microsoft.com/en-us/library/ms524602%28v=VS.90%29)と編集されました。 aspx)。 – vcsjones

+0

鮮やかな、ちょうど私が後だった。 – Paul