我很确定我在我的Web.config文件中正确编码了WCF URL重写规则:
<rewrite>
<rules>
<rule name="RemoveSVC" stopProcessing="true">
<match url="MyWebSvc/([a-zA-Z]+)-svc/(.*)" />
<action type="Rewrite" url="MyWebSvc/{R:1}.svc/{R:2}" appendQueryString="true" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
重写规则似乎在“测试模式......”小部件中起作用。例如:
http://localhost/MyWebSvc/thinga-svc/majigs
正确映射到:
{R-1} thinga
{R-2} majigs
我希望将URL重写为:
http://localhost/MyWebSvc/thinga.svc/majigs
然而,当我尝试从浏览器测试URL时,似乎很简单:
http://localhost/MyWebSvc/thinga.svc/majigs
有效,但
http://localhost/MyWebSvc/thinga-svc/majigs
似乎没有重写,我收到了404响应代码。我是否必须将规则配置为使用其他设置触发?