我收到错误“无法访问请求的页面,因为页面的相关配置数据无效。”当我在WCF应用程序的web.config中使用rewrite元素时。
<rewrite>
<rules>
<rule name="Rewrite Index">
<match url="myApplicaiton/Healthcheck.aspx" />
<action type="Redirect" url="HealthCheck.aspx" />
</rule>
</rules>
</rewrite>
如果请求网址包含“myApplication”http://localhost/myApplication/HealthCheck.aspx,我想要重定向(服务器重定向)。如果在上面的配置中有任何问题,请告诉我,如果有任何其他方式在WCF app web.config中重定向静态文件,请告诉我
答案 0 :(得分:1)
您应该在iis中安装Url Rewrite extension
。
答案 1 :(得分:0)
你需要条件,试试这种格式
<rule name="ruleName">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^myApplicaiton\Healthcheck$" negate="true" />
</conditions>
<action type="Redirect" url="HealthCheck.aspx" />
</rule>