In IIS, can I use the same base path for multiple Web API applications?
asp.net-web-api, deployment, iis, servicestack
Solution
Reverse Proxying / Url Rewriting to different ServiceStack instances
An elegant option is to separate them into distinct Services and conceptually have them appear under the same url structure by using a reverse proxy or rewrite rules in IIS which will let you have different top-level paths mapped to different independent ServiceStack instances, e.g:
- http://api.domain.com/productA -> http://localhost:8000
- http://api.domain.com/productB -> http://localhost:8001
- http://api.domain.com/productC -> http://localhost:8002
Problem
Is there any way to have multiple, independent iis websites that all use the same URL base path? I have a Web API application that contains http webservices grouped by domain (order, product, shipping, etc...). I want to break those domains into individual API applications so that I can deploy them individually. The only problem is that I don't know how I'd deploy these to iis without having a different url path for each API application. For example, currently (since every web service is in a single WEB API application), if i want to use the order API, i simply use ``` http://localhost/api/order/{order-id} ``` If i were to break apart the application into smaller web applications (1 per domain), is there any way i can continue to use ``` http://localhost/api ``` as my base path? Or will I have to use something like: ``` http://localhost/OrderApi/order/{order-id} ```