Sharing API's between multiple sites in IIS 8.5
-
Hello, I am trying to share a few API's between multiple sites on the same server (IIS 8.5). In a simple architecture, I would have each site on its own port, and each API on its own port, with the sites pointing to the API's they need. Unfortunately, we have a restriction that forces us to have the actual API's "under" the main site, by using "add application" in IIS, and using aliases for each API. This works fine actually. What I would like to now is to have other sites use the same API's, also by having aliases, but without physically duplicating the API's either on disk, or even in memory. Put simply, it looks like this: localhost:1000/index.html = site1 localhost:1000/aliasAPI1/… = api1 localhost:1000/aliasAPI2/… = api2 … and I would like: localhost:2000/index.html = site2 localhost:2000/aliasAPI1/… = api1 = same as on site 1, in the same physical folder localhost:2000/aliasAPI2/… = api2 = same as on site 1, in the same physical folder The reason being that site 1 is fully intranet, and site 2 will be visible from the outside world via junctions created somewhere else on the network, and where we want to enable only 1 port to reach site 2. I actually made a test simply by adding applications under site 2, and pointing physically to the same API folders, and it works, but it shows that the API's are ran twice in memory. Tried both in the same application pool, and in separate pools. Is there a way to really share the API's in a configuration like this one ? I've Googled the issue.. but couldn't find anything relevant :( Any help would be appreciated :) Fred
-
Hello, I am trying to share a few API's between multiple sites on the same server (IIS 8.5). In a simple architecture, I would have each site on its own port, and each API on its own port, with the sites pointing to the API's they need. Unfortunately, we have a restriction that forces us to have the actual API's "under" the main site, by using "add application" in IIS, and using aliases for each API. This works fine actually. What I would like to now is to have other sites use the same API's, also by having aliases, but without physically duplicating the API's either on disk, or even in memory. Put simply, it looks like this: localhost:1000/index.html = site1 localhost:1000/aliasAPI1/… = api1 localhost:1000/aliasAPI2/… = api2 … and I would like: localhost:2000/index.html = site2 localhost:2000/aliasAPI1/… = api1 = same as on site 1, in the same physical folder localhost:2000/aliasAPI2/… = api2 = same as on site 1, in the same physical folder The reason being that site 1 is fully intranet, and site 2 will be visible from the outside world via junctions created somewhere else on the network, and where we want to enable only 1 port to reach site 2. I actually made a test simply by adding applications under site 2, and pointing physically to the same API folders, and it works, but it shows that the API's are ran twice in memory. Tried both in the same application pool, and in separate pools. Is there a way to really share the API's in a configuration like this one ? I've Googled the issue.. but couldn't find anything relevant :( Any help would be appreciated :) Fred
I suspect you'll need to use the Application Request Routing module to route all API requests to a single application: Using the Application Request Routing Module | Microsoft Docs[^] iis 7.5 - Application Request Routing doesn't route to same machine - Stack Overflow[^] How to configure Application Request Routing in IIS 7.0 for 2 applications running locally on different ports? - Stack Overflow[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
I suspect you'll need to use the Application Request Routing module to route all API requests to a single application: Using the Application Request Routing Module | Microsoft Docs[^] iis 7.5 - Application Request Routing doesn't route to same machine - Stack Overflow[^] How to configure Application Request Routing in IIS 7.0 for 2 applications running locally on different ports? - Stack Overflow[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer