我對我的網站使用url重寫。我在IIS上做了設置,它在服務器上工作。但它在本地主機上不起作用。這很正常,因爲在我的項目文件中沒有帶重新編址的頁面。我怎麼解決這個問題?我在開發項目時使用cassini服務器。我應該在我的電腦中使用本地IIS嗎?你可以在這裏看到我的url重寫web.config文件中的角色:Url重寫在IIS上工作,但不在localhost中
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<rewrite>
<outboundRules>
<rule name="OutboundRewriteUserFriendlyURL1" preCondition="ResponseIsHtml1">
<match filterByTags="A, Form, Img" pattern="^(.*/)ProductDetail\.aspx\?prid=([^=&]+)&(?:amp;)?product=([^=&]+)$" />
<action type="Rewrite" value="{R:1}ProductDetail/{R:2}/{R:3}/" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
<rules>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^urun/([^/]+)/([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="ProductDetail.aspx?prid={R:1}&product={R:2}" />
</rule>
</rules>
</rewrite>
<urlCompression doDynamicCompression="false" />
</system.webServer>
相關:http://stackoverflow.com/q/2708187/1001985,http://stackoverflow.com/q/963545/1001985 – McGarnagle