I am trying to figure out how to use url rewrite and Application Request Routing (ARR) to rewrite across different app pools on the same server.
In a simplified version, here is what I have: a REST service API is implemented with 2 virtual directories, Service.A and B, so virtual directory is part of url to access to access resources A and B
GET [https://]api.mycompany.com/Service.A/A
GET [https://]api.mycompany.com/Service.B/B
What I want to achieve is to have one single external url for the api without virtual directory names, and obviously not having to go through a code refactoring (to merge solution files and builds)
GET [https://]api.mycompany.com/A
GET [https://]api.mycompany.com/B
I implemented a url rewrite rule to match /A in path and replace with /Service.A/A, with some code like this in web.config at the default web site level, which works fine.
<rewrite>
<rule name="AddServicePrefix" enabled="true">
<match url="^A[/]?.*" />
<action type="Rewrite" url="/Service.A/{R:0}" />
</rule>
</rewrite>
The problem is that when I assign a different application pool to Service.A (from the app pool of default web site), this will fail immediately with a 403 error, but this is a requirement on our side to have applications/virtual directories running under different app pools to minimize impact when any pool fails or recycles.
I have done some research. This previous post below basically said "if you want to re-route request to another app-pool, you have to make a hop, whether that hop is over winsock or named pipe or whatever else" without much details. I also went through ARR guide but couldn't figure out exactly how to use ARR for this case.
http://forums.iis.net/t/1151510.aspx?Rewrite+across+application+pools+
Any help? Suggestions and comments whether I am in the right direction?
Thanks!
oh, forget to mention the environment: currently in dev environment, IIS 7.5 on Windows 7, Url Rewrite 2.0, and ARR 3.0, installed by Web Platform Installer.