简体   繁体   中英

Bind sub-application using IP Address in IIS

I am working on an MVC .NET application which needs to run on two different domains. By Default the application is running on the following domain (suppose):

www.domain1.com

I want to run the application on the following domain too.

www.domain2.com/domain1

Both Domain1.com and Domain2.com are running on separate servers. I can't do bindings in IIS using IP Address for (Domain2) because it requires a physical path for the application. But in our case the application ( Domain1 ) would be on a separate server.

How can we achieve this , is there a way out?

Solution 1

You can do a couple of things.

1) create a wildcard DNS mapping pointed to a single IP address to your server, then use host-headers on each website, in your case 1 IIS site for each sub-domain

2) You can create an A record in DNS for each sub-domain pointing to an ip address hosted on your server. Creating individual sub-domains records is more administrative overhead, but is a technical solution.

http://support.microsoft.com/kb/190008 (although this applies to IIS 5, the concept is the same)

Solution 2

Use “Site Bindings” to specify host names for sites. In IIS Management Console select a site, then on right side under actions select Bindings…. In the Site Bindings dialog select the http binding and click Edit… here you can set the URL for that site.

Right click on domain2.com in under IIS sites and choose "Add Application". In "Alias" type in domain1 ; choose another application pool if needed; specify the physical path to your application.

You're good to go!

UPDATE

Now I see the dilemma - both applications running on different servers.

SOLUTION 1

If both servers are connected in an intranet, you can share the file system folder for domain1 and map it as drive on the IIS where domain2 is hosted or use UNC name to resolve the shared resource on a network, directly in the physical path field. Then the procedure above applies.

SOLUTION 2

If the IIS hosts are located on the internet, without direct connection between, you need to engage URL Rewrite or something similar. You can find thousands of posts about this approach by googling it. Here is a Server Fault post on the subject.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM