IIS7 URL Rewrite returns 404 for WCF requests (reverse proxy)

╄→гoц情女王★ 提交于 2019-12-03 08:54:26

The solution to this is in the config file of the Target web site.

In web.config (in the Target application) there is a section which read:

<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>.

I changed this to read:

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />.

Credit must go to http://forums.iis.net/post/1956671.aspx for this (although s/he claims it is the proxy's config which needs to be changed, but I found it be the Target app, not the proxy server).

If you still can't get it running, make sure you don't have the WCF handlers on the website which acts as the reverse proxy. I disabled this by adding this web.config of the reverse proxy:

 <system.webServer>    
  ...
 <handlers>
  <remove name="svc-ISAPI-4.0_64bit" />
  <remove name="svc-ISAPI-4.0_32bit" />
  <remove name="svc-Integrated-4.0" />
 </handlers>
</system.webServer>

Because the rewrite appears to work for all resources except when the extension is .svc I would say this would be the area to concentrate on.

I would imagine that the rewrite rules are matching your other resources, but not your service, and because these are usually regular expressions (which are often complicated) I would say it would be worth testing any rules you find with your urls. Details of how to find the regular expressions for an UrlRewrite can be found here.

It is also probably also worth looking at any outbound rules with the same mindset.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!