title: IIS7 URL Rewrite returns 404 for WCF requests (reverse proxy)
body: <p>I am using IIS7.5, .net 4.0. I am working locally.</p>
  
  <p>I have installed Application Request Routing, Web Farm Framework, WebDeploy and UrlRewrite to set up a reverse proxy. This works fine for the most part.</p>
  
  <p>I have two websites:</p>
  
  <ul>
  <li>DefaultWebSite (port 80, app pool: Default App Pool (.net 4)) and </li>
  <li>Target (port 8085, app pool: TargetAppPool(my identity, .net 4)).</li>
  </ul>
  
  <p>I have a rewrite rule on DefaultWebSite (created as directed on <a href="http://www.iis.net/learn/extensions/url-rewrite-module/reverse-proxy-rule-template" rel="nofollow">IIS.net</a>) which redirects all localhost (port 80) traffic to <strong>localhost:8085</strong> just as detailed in the above link. This works fine for most document types (.aspx, .xap, .htm, .ico) but a request to MyService.svc fails. It returns a 404. </p>
  
  <p>To be clear:</p>
  
  <p>When I paste <strong>localhost:8085/MyService.svc</strong> into a browser I get the requested WCF page.</p>
  
  <p>When I paste <strong>localhost/MyService.svc</strong> into a browser I get a 404. </p>
  
  <p>When I paste <strong>localhost:8085/MyIcon.ico</strong> into a browser I get the requested resource. </p>
  
  <p>When I paste <strong>localhost/MyIcon.ico</strong> into a browser I get the requested resource. </p>
  
  <p>.svc is the only document type that I've found that returns a 404.</p>
  
  <p>I've got two pieces of info that might be of relevance.</p>
  
  <ol>
  <li><p>App Pools. When I change the DefaultWebSite's app pool to TargetAppPool then the 404 becomes a 500 ("Failed to map the path '/'"). All other requests are successful when this change is made. Not sure if this relevant or not.</p></li>
  <li><p>FREB (Failed Request Tracing) Log. I found a page (<a href="http://blogs.msdn.com/b/asiatech/archive/2011/08/25/return-404-4-not-found-when-url-rewrite.aspx" rel="nofollow">http://blogs.msdn.com/b/asiatech/archive/2011/08/25/return-404-4-not-found-when-url-rewrite.aspx</a>) which details the steps in a FREB log when a URL rewrite is more successful than mine (it fails later on). I've not been able to find out how to generate a FREB log for a successful rewrite (if that's possible) so I can only compare my FREB log to the one on that blog. I can see that their step 21 (URL_CHANGED) in my FREB log but not 22 (URL_REWRITE_END). I've not got enough experience with these logs to notice anything more significant than that (suggestions welcomed).</p></li>
  </ol>
  
  <p>My main question is: does anyone know why just URLs requesting .svc resources are not being rewritten? </p>
  
  <p>A secondary question is: does anyone know how to generate a FREB log for successful request (if it's even possible)? </p>
  
  <p>Thanks</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I have changed the architecture to try to get more info.</p>
  
  <p>I have moved the Target website to a different PC on which I have installed Microsoft Network Monitor to capture the incoming traffic.</p>
  
  <p>Before I changed the url-rewrite rule to point at this new website I got the correct response when I made a request to MyService.svc on the new PC. Fine.</p>
  
  <p>As soon as I changed the rewrite rule to route the request to the new Target website then it responds as before (404). I have made both POST and GET requests. There is no sign of any of the requests in the Network Monitor log (all other calls -200, 404 or otherwise- appear in this log).  </p>
  
  <p>This leads me to think that there is something incompatible with url-rewrites and *.svc requests. I tried making a request to MyService.asmx (having created this file) and it correctly returned a page, so it is limited to *.svc.  Any ideas?</p>