tags:

views:

1844

answers:

2

Here's the scenario: Server A is hosting the 'main' application (www.example.com) Server B is hosting a support application (b.example.com) They are connected internally to each other through a 192.* address and are both externally available through DNS

Server A has several virtual directories that are mapped through UNC shares: www.example.com/virtual1 -> \192.168.1.1\virtual1 (on serverB)

I'd like to be able to run the application that sits on Server B (served through IIS) and make it appear as if it's running on serverA:

www.example.com/application -> b.example.com/app

I'd still want to be able to access server B directly

b.example.com/app

Any ideas?

Edit:


Turns out the application behind the proxy refused to let me dynamically change it's form "action" (nor did it let me change anything else). I was able to display the data from the server; just couldn't post :(

So both answers pointed me in the right direction. I used a proxy:

http://code.google.com/p/iisproxy/

I created a virtual directory on Server A that matched the directories I needed on Server B - and it worked! :-)

+1  A: 

This should be possible in IIS. I remember I had to do this once.

Just create a virtual directory using the UNC path pointing to \\ServerB\SharedAppDirOnB and (if necessary) "Connect As..." using the credentials needed for Server B.

If you have problems with "Connect As..." it could be a folder permissions problem of Server B. Try the following thing: add a new user account on your main server which has the same name and password as the account on Server B. It sounds stupid, but I remember it solved my issue. You could for example add a new user account on both servers: "IisCommon" with the same passwords on both servers. Then make sure you give all necessary file access permission to the folder on server B (and the Share permission!). Try first connecting manually using Windows Explorer if you can access the share.

Make sure that you mark the new virtual directory as application and give the right execution permissions.


Another solution would be some kind of reverse proxy. I used a third-party product on IIS 6.0 for this: ISAPIrewrite for IIS. The "proxy" mode allows you to "forward" request made to your main server (www.example.com/...) to your other server, but serving the resulting responses as if they were processed by your main "domain" application. The feature is called "proxy directive". It accepts regular expressions.

splattne
didn't work :(I did the "connect as" with a domain admin account (just to make sure), set it up with execute permissions, and verified the correct ASP.Net version.Gives me a 404 error - appears as if the .dll file I'm accessing is looking for resources on server A that don't exist
JayTee
Hm, I had this problem too: try to add a new user account on your main server which has the same name and password as the account on Server B. That should solve the problem.
splattne
+1  A: 

Since serving the virtual directory from server A through a UNC share apparently does not work, you need to serve b.example.com/app from server b.

DNS resolves domain names to IP addresses. You are asking for the same domain name to resolve to two different IP addresses, based on a different URL. This is not something that IIS or Windows can do.

Your options are:

  • write a proxy service on server A that passes requests on to server B. If you want it completely transparent (not just a redirect), you'd have to stream back the response as well. This is not trivial, but possible.

  • Put the server B page into an IFRAME on a new page on server A.

  • Use a load balancer in front of both servers that can split traffic based on URL
cdonner