views:

515

answers:

6

We have a web application on our server in a directory

 c:\inetpub\wwwroot\myapp

Inside the myapp directory we have a sub directory called mysubapp. mysubapp has its own bin directory, and requires DLLs in the myapp\bin directory

So the directories are as follows:

c:\inetpub\wwwroot\myapp
c:\inetpub\wwwroot\myapp\bin
c:\inetpub\wwwroot\myapp\mysubapp
c:\inetpub\wwwroot\myapp\mysubapp\bin

We currently have IIS set up with host headers so that myapp.mycompany.com points to c:\inetpub\wwwroot\myapp and http://mysubapp.mycompany.com redirects to http://myapp.mycompany.com/mysubapp.

We want mysubapp.mycompany.com to point to c:\inetpub\wwwroot\myapp\mysubapp without having the URL say http://myapp.mycompany.com/mysubapp.

I've tried setting up host headers to point but c:\inetpub\wwwroot\myapp\mysubapp without using a redirect, but when we do this we get an error saying that certain DLL files can't be found, the DLL files not found are the ones in c:\inetpub\wwwroot\myapp\bin. This error makes sense because an application can't locate DLLs outside of it's application directory.

Is there any way we can configure IIS to get this to work?

+1  A: 

Although the answer doesn't take into account host headers the proposed work around in this link might be useful.

Jonathan Parker
A: 

A solution not involving url rewriting would be the following:

  1. Assign myapp.mycompany.com and mysubapp.mycompany.com different IP addresses in DNS, but they should map to the same host (Robert explains below how, or use 2 NICs).
  2. Create 2 Web Sites (not Virtual Directories) in IIS.
  3. Map the first one to an IP address of myapp.mycompany.com and point to c:\inetpub\wwwroot\myapp
  4. Map the second one to an IP address of mysubapp.mycompany.com and point to c:\inetpub\wwwroot\myapp\mysubapp
  5. ???
  6. Profit :)
DreamSonic
I don't understand why two IP addresses or even two network cards. this doesn't solve his problem IMHO.
splattne
Web Sites allow handling / (root) requests without additional pain in the ass. That's the way IIS is intended to work. You could try to bypass this behavior with url rewriting, but it's rather error-prone.2 IP addresses would allow 2 Web Sites, so they will be able to serve 2 domains.
DreamSonic
There is no need to use 2 IPs, IIS can handle different host names with the same IP
Eduardo Molteni
That's pretty much what I do (except for the two seperate IP addresses) but because mysubapp needs dlls in myapp, this configuration will cause mysubapp to error out.
Jeremy
A: 

As DreamSonic said, use a different website for each application, with different IP addresses for each. To add more than a single IP to the server, use the advanced button on the Internet Protocol (tcp/Ip) dialog box in Network Properties. In IIS, set the website to respond to the specified IP instead of the default of [All Unassigned]. You don't need two (or more) NIC's.

Other than that, you'll need to do some URL rewriting, which can be a pain because all of the links in your app will need to "fixed" or else you'll eventually end up with the undesirable URL in the client's browser.

Robert C. Barth
I don't understand how 2 ip addresses would solve the problem.
splattne
+4  A: 

If I correctly understand your question, the only working setup that I could imagine is to take the approach you mention (host headers to point but c:\inetpub\wwwroot\myapp\mysubapp without using a redirect) and include the main app's DLLs in your sub folder's bin directory.

splattne
Agreed - one possible solution to having multiple copies of the DLLs in each app would be strongly name the common dlls and install them in the Global Assembly Cache.
Zhaph - Ben Duguid
A: 

If you want to serve /mysubapp under a different domain name, I don't see the point in keeping it under myapp.

Set up the applications as separate web apps, and copy the dlls from myapp to mysubapp. As it is Asp.Net, you may even do some assembly binding magic via the web.config file.

devio
The reason it is under myapp is due to licensing issues. It's an ektron (CMS) site, and we have a license for one site, so if we broke out to two sites it would break our licensing agreement. A little sill I know.
Jeremy