IIS URL重写不适用于IIS 7.5 Windows 2008R2 SP1

时间:2015-08-24 20:46:30

标签: iis

我无法让IIS Url Rewrite在IIS 7.5上运行

我安装了最新的IIS URL重写模块 https://msdn.microsoft.com/en-us/library/azure/jj156212.aspx

现在以下规则正在运作

<rule name="TestRewrite" stopProcessing="true">
                    <match url="abc\/(.*)" />
                    <action type="Rewrite" url="http://localhost:8082/{R:1}" logRewrittenUrl="true" />
                </rule>

但是这条规则不是

<table class=3DMsoNormalTable border=3D1 cellspacing=3D0 cellpadding=3D0 wi=d th=3D "112%" style=3D 'width:112.1%;border-collapse:collapse;mso-yfti-tbllook:1184;mso-p=
adding-alt:
 0in 0in 0in 0in'>
  <tr style=3D 'mso-yfti-irow:0;mso-yfti-firstrow:yes'>
    <td width=3D "27%" valign=3Dtop style=3D 'width:27.6%;background:#E9EEF2;pa=
dding:
  .75pt 15.0pt .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-top:6.0pt;margin-right:0in;margin-bo=
ttom:
  18.75pt;margin-left:0in;line-height:normal;word-break:break-all'><span style=3D 'font-size:12.0pt;font-family:"Times New Roman","serif";mso-farea=
st-font-family:
  "Times New Roman";color:black'>URL_REWRITE_START<o:p></o:p></span>
      </p>
    </td>
    <td width=3D "57%" valign=3Dtop style=3D 'width:57.76%;background:#E9EEF2;p=
adding:
  .75pt 15.0pt .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 36=
6.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span class=3DSpellE><span style=3D'font-size:12.0pt;font-family:"Verdana","san=
s-serif";
  mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Courier N=
ew";
  color:black'>RequestURL</span></span><span style=3D 'font-size:12.0pt;
  font-family:"Verdana","sans-serif";mso-fareast-font-family:"Times New Rom=
an";
  mso-bidi-font-family:"Courier New";color:black'>=3D&quot;/<span class=3DS=
pellE>abc</span>/index.html&quot;, Scope=3D&quot;Distributed&quot;, Type=3D&quot;Inbound&quot;
        <o:p></o:p>
        </s=p an>
      </p>
    </td>
    <td width=3D "14%" valign=3Dtop style=3D 'width:14.66%;background:#E9EEF2;p=
adding:
  .75pt 15.0pt .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal'><span style=3D 'font-size:12.0pt;font-family:"Times New Roman","se=
rif";
  mso-fareast-font-family:"Times New Roman";color:black'>22:46:22.772<o:p><=
/o:p></span>
      </p>
    </td>
  </tr>
  <tr style=3D 'mso-yfti-irow:1'>
    <td width=3D "27%" valign=3Dtop style=3D 'width:27.6%;padding:.75pt 15.0pt =
.75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;word-break:break-all'><span style=3D 'font-size:12.0pt;font-family:=
"Times New Roman","serif";
  mso-fareast-font-family:"Times New Roman"'>RULE_EVALUATION_START<o:p></o:=
p></span>
      </p>
    </td>
    <td width=3D "57%" valign=3Dtop style=3D 'width:57.76%;padding:.75pt 15.0pt=
 .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 36=
6.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span class=3DSpellE><span style=3D'font-size:12.0pt;font-family:"Verdana","san=
s-serif";
  mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Courier N=
ew"'>RuleName</span></span><span style=3D 'font-size:12.0pt;font-family:"Verdana","sans-serif";mso-fareast-=
font-family:
  "Times New Roman";mso-bidi-font-family:"Courier New"'>=3D&quot;<span
  class=3DSpellE>TestRewrite</span>&quot;, <span class=3DSpellE>RequestURL<=
/span>=3D&quot;<span
  class=3DSpellE>abc</span>/index.html&quot;, <span class=3DSpellE>QueryStr=
ing</span>=3D&quot;&quot;,
        <span class=3DSpellE>PatternSyntax</span>=3D&quot;Regex&quot;, <span class=3DSpellE>StopProcessing</span>=3D&quot;true&quot;, <span class=3DSp=e llE>RelativePath</span>=3D&quot;/&quot;
        <o:p></o:p>
        </span>
      </p>
    </td>
    <td width=3D "14%" valign=3Dtop style=3D 'width:14.66%;padding:.75pt 15.0pt=
 .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal'><span style=3D 'font-size:12.0pt;font-family:"Times New Roman","se=
rif";
  mso-fareast-font-family:"Times New Roman"'>22:46:22.772<o:p></o:p></span>=
      </p>
    </td>
  </tr>
  <tr style=3D 'mso-yfti-irow:2'>
    <td width=3D "27%" valign=3Dtop style=3D 'width:27.6%;background:#E9EEF2;pa=
dding:
  .75pt 15.0pt .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;word-break:break-all'><span style=3D 'font-size:12.0pt;font-family:=
"Times New Roman","serif";
  mso-fareast-font-family:"Times New Roman";color:black'>PATTERN_MATCH<o:p>=
</o:p></span>
      </p>
    </td>
    <td width=3D "57%" valign=3Dtop style=3D 'width:57.76%;background:#E9EEF2;p=
adding:
  .75pt 15.0pt .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 36=
6.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span style=3D 'font-size:12.0pt;font-family:"Verdana","sans-serif";mso-fareast-=
font-family:
  "Times New Roman";mso-bidi-font-family:"Courier New";color:black'>Pattern=
=3D&quot;<span
  class=3DSpellE>abc</span>\/(.*)&quot;, Input=3D&quot;<span class=3DSpellE=>abc</span>/index.html&quot;, Negate=3D&quot;false&quot;, Matched=3D&quot;true&quot;
        <o:p></o:p>
        </span>
        <=/ p>
    </td>
    <td width=3D "14%" valign=3Dtop style=3D 'width:14.66%;background:#E9EEF2;p=
adding:
  .75pt 15.0pt .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal'><span style=3D 'font-size:12.0pt;font-family:"Times New Roman","se=
rif";
  mso-fareast-font-family:"Times New Roman";color:black'>22:46:22.772<o:p><=
/o:p></span>
      </p>
    </td>
  </tr>
  <tr style=3D 'mso-yfti-irow:3'>
    <td width=3D "27%" valign=3Dtop style=3D 'width:27.6%;padding:.75pt 15.0pt =
.75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;word-break:break-all'><span style=3D 'font-size:12.0pt;font-family:=
"Times New Roman","serif";
  mso-fareast-font-family:"Times New Roman"'>REWRITE_ACTION<o:p></o:p></spa=
n></p>
  </td>
  <td width=3D"57%" valign=3Dtop style=3D'width:57.76%;padding:.75pt 15.0pt=
 .75pt .75pt'>
  <p class=3DMsoNormal style=3D'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 36=
6.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  style=3D'font-size:12.0pt;font-family:"Verdana","sans-serif";mso-fareast-=
font-family:
  "Times New Roman";mso-bidi-font-family:"Courier New"'>Substitution=3D&quo=
t;http://localhost:8082/{R:1}&quot;,
  <span class=3DSpellE>RewriteURL</span>=3D&quot;http://localhost:8082/inde= x.html&quot;,
        <span class=3DSpellE>AppendQueryString</span>=3D&quot;true&quot;, <span class=3DSpellE>LogRewrittenURL</span>=3D&quot;true&quot;
        <o:p></o:p>
        </span=>
      </p>
    </td>
    <td width=3D "14%" valign=3Dtop style=3D 'width:14.66%;padding:.75pt 15.0pt=
 .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal'><span style=3D 'font-size:12.0pt;font-family:"Times New Roman","se=
rif";
  mso-fareast-font-family:"Times New Roman"'>22:46:22.772<o:p></o:p></span>=
      </p>
    </td>
  </tr>
  <tr style=3D 'mso-yfti-irow:4'>
    <td width=3D "27%" valign=3Dtop style=3D 'width:27.6%;background:#E9EEF2;pa=
dding:
  .75pt 15.0pt .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;word-break:break-all'><span style=3D 'font-size:12.0pt;font-family:=
"Times New Roman","serif";
  mso-fareast-font-family:"Times New Roman";color:black'>RULE_EVALUATION_EN=
D<o:p></o:p></span>
      </p>
    </td>
    <td width=3D "57%" valign=3Dtop style=3D 'width:57.76%;background:#E9EEF2;p=
adding:
  .75pt 15.0pt .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 36=
6.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span class=3DSpellE><span style=3D'font-size:12.0pt;font-family:"Verdana","san=
s-serif";
  mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Courier N=
ew";
  color:black'>RuleName</span></span><span style=3D 'font-size:12.0pt;font-f=
amily:
  "Verdana","sans-serif";mso-fareast-font-family:"Times New Roman";mso-bidi=
-font-family:
  "Courier New";color:black'>=3D&quot;<span class=3DSpellE>TestRewrite</spa=
n>&quot;,
  <span class=3DSpellE>RequestURL</span>=3D&quot;http://localhost:8082/inde= x.html&quot;,
        <span class=3DSpellE>QueryString</span>=3D&quot;&quot;, <span class=3DSpe=l lE>StopProcessing</span>=3D&quot;true&quot;, Succeeded=3D&quot;true&quot;
        <o:p></o:p>
        </span>
      </p>
    </td>
    <td width=3D "14%" valign=3Dtop style=3D 'width:14.66%;background:#E9EEF2;p=
adding:
  .75pt 15.0pt .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal'><span style=3D 'font-size:12.0pt;font-family:"Times New Roman","se=
rif";
  mso-fareast-font-family:"Times New Roman";color:black'>22:46:22.772<o:p><=
/o:p></span>
      </p>
    </td>
  </tr>
  <tr style=3D 'mso-yfti-irow:5'>
    <td width=3D "27%" valign=3Dtop style=3D 'width:27.6%;padding:.75pt 15.0pt =
.75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;word-break:break-all'><span style=3D 'font-size:12.0pt;font-family:=
"Times New Roman","serif";
  mso-fareast-font-family:"Times New Roman"'>GENERAL_SET_REQUEST_HEADER<o:p=
></o:p></span>
      </p>
    </td>
    <td width=3D "57%" valign=3Dtop style=3D 'width:57.76%;padding:.75pt 15.0pt=
 .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 36=
6.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span class=3DSpellE><span style=3D'font-size:12.0pt;font-family:"Verdana","san=
s-serif";
  mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Courier N=
ew"'>HeaderName</span></span><span style=3D 'font-size:12.0pt;font-family:"Verdana","sans-serif";mso-fareast-=
font-family:
  "Times New Roman";mso-bidi-font-family:"Courier New"'>=3D&quot;X-Original=
-URL&quot;,
  <span class=3DSpellE>HeaderValue</span>=3D&quot;/<span class=3DSpellE>abc=
</span>/index.html&quot;, Replace=3D&quot;true&quot;
        <o:p></o:p>
        </span>
      </p>
    </td>
    <td width=3D "14%" valign=3Dtop style=3D 'width:14.66%;padding:.75pt 15.0pt=
 .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal'><span style=3D 'font-size:12.0pt;font-family:"Times New Roman","se=
rif";
  mso-fareast-font-family:"Times New Roman"'>22:46:22.772<o:p></o:p></span>=
      </p>
    </td>
  </tr>
  <tr style=3D 'mso-yfti-irow:6'>
    <td width=3D "27%" valign=3Dtop style=3D 'width:27.6%;background:#E9EEF2;pa=
dding:
  .75pt 15.0pt .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;word-break:break-all'><span style=3D 'font-size:12.0pt;font-family:=
"Times New Roman","serif";
  mso-fareast-font-family:"Times New Roman";color:black'>URL_CHANGED<o:p></=
o:p></span>
      </p>
    </td>
    <td width=3D "57%" valign=3Dtop style=3D 'width:57.76%;background:#E9EEF2;p=
adding:
  .75pt 15.0pt .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 36=
6.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span class=3DSpellE><span style=3D'font-size:12.0pt;font-family:"Verdana","san=
s-serif";
  mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Courier N=
ew";
  color:black'>OldUrl</span></span><span style=3D 'font-size:12.0pt;font-fam=
ily:
  "Verdana","sans-serif";mso-fareast-font-family:"Times New Roman";mso-bidi=
-font-family:
  "Courier New";color:black'>=3D&quot;/<span class=3DSpellE>abc</span>/inde= x.html&quot;,
        <span class=3DSpellE>NewUrl</span>=3D&quot;http://localhost:8082/index.ht= ml&quot;
        <o:p></o:p>
        </span>
      </p>
    </td>
    <td width=3D "14%" valign=3Dtop style=3D 'width:14.66%;background:#E9EEF2;p=
adding:
  .75pt 15.0pt .75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal'><span style=3D 'font-size:12.0pt;font-family:"Times New Roman","se=
rif";
  mso-fareast-font-family:"Times New Roman";color:black'>22:46:22.772<o:p><=
/o:p></span>
      </p>
    </td>
  </tr>
  <tr style=3D 'mso-yfti-irow:7;mso-yfti-lastrow:yes'>
    <td width=3D "27%" valign=3Dtop style=3D 'width:27.6%;padding:.75pt 15.0pt =
.75pt .75pt'>
      <p class=3DMsoNormal style=3D 'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;word-break:break-all'><span style=3D 'font-size:12.0pt;font-family:=
"Times New Roman","serif";
  mso-fareast-font-family:"Times New Roman"'>URL_REWRITE_END<o:p></o:p></sp=
an></p>
  </td>
  <td width=3D"57%" valign=3Dtop style=3D'width:57.76%;padding:.75pt 15.0pt=
 .75pt .75pt'>
  <p class=3DMsoNormal style=3D'margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
  normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 36=
6.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  class=3DSpellE><span style=3D'font-size:12.0pt;font-family:"Verdana","san=
s-serif";
  mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Courier N=
ew"'>RequestURL</span></span><span style=3D 'font-size:12.0pt;font-family:"Verdana","sans-serif";mso-fareast-=
font-family:
  "Times New Roman";mso-bidi-font-family:"Courier New"'>=3D&quot;http://loc=
alhost:8082/index.html&quot;<o:p></o:p></span>
      </p>
    </td>
    <td width=3D "14%" style=3D 'width:14.66%;border-top:none;border-left:none;
  border-bottom:inset 1.0pt;border-right:inset 1.0pt;mso-border-bottom-alt:
  inset windowtext .75pt;mso-border-right-alt:inset windowtext .75pt;
  padding:0in 0in 0in 0in'></td>
  </tr>
</table>

跟踪结果

&#13;
&#13;
CREATE PROCEDURE BusinessInfo
  @Variable VarChar(10)
AS
BEGIN
  SELECT   Info.*
  FROM     Table Info
  WHERE    Info.PersonKey = @Variable
  ORDER BY Info.LastName
END
GO
EXECUTE BusinessInfo '1'
GO
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

您可能需要仔细检查您的正则表达式,以了解您的期望。该表达式与localhost不匹配,因为abc不在开头。这符合您的网址:

abc\/(.*)

请注意,我们正在寻找任何地方的abc以及逃避斜线,我们可以用任何东西结束。