I'm trying to figure out how to use URL rewriting and application request routing (ARR) to rewrite in different application pools on the same server.
In the simplified version, here is what I have: the REST API is implemented with two virtual directories Service.A and B, so the virtual directory is part of the URL for 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 external url for api without virtual directory names and, obviously, you do not need to go through code refactoring (to combine solution files and assemblies)
GET [https: //] api.mycompany.com/A
GET [https: //] api.mycompany.com/B
I applied the url rewrite rule to match / A in the path and replaced it with /Service.A/A, with some code like this in web.config at the default website 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 another application pool to Service.A (from the default application pool of the website), it immediately gets a 403 error, but it is a requirement on our side to have applications / virtual directories working under different pools applications to minimize exposure when a pool is down or being processed.
I did some research. This previous post below basically said: "If you want to redirect the request to another application pool, you need to make a hop, regardless of whether this hop is located through winsock or a named pipe or something else" without any particular details. I also went through the ARR manual, but was unable to determine exactly how to use ARR for this case.
http://forums.iis.net/t/1151510.aspx?Rewrite+across+application+pools+
Any help? Suggestions and comments, am I in the right direction?
Thanks!
Oh, forget to mention the environment: currently in a dev environment, IIS 7.5 on Windows 7, Url Rewrite 2.0, and ARR 3.0 installed by the web platform installer.