Multiple instances of an ASP.net application from the same website configuration in IIS

As the name implies, I would like to create a single website in IIS that creates several instances of the ASP.net application based on the requested site.

So, all instances work with the same code base, but each instance has its own application object, a collection of sessions, etc.

For instance:

  host1.domain.tld / default.aspx -> this.Application ["foo"] = "host1"
 host2.domain.tld / default.aspx -> this.Application ["foo"] = "host2"
 host3.domain.tld / default.aspx -> this.Application ["foo"] = "host3"

I know that I can configure IIS to listen on a specific IP address and set the DNS for the host (1 | 2 | 3) .domain.tld to point to that IP address. Then use Global.asax to check the required host to configure specific host settings. But the application will still work as a single instance on the server.

I would prefer to have multiple instances of the application running for each host so that their execution time is completely shared, it would be nice if I could also have them in separate application pools, but this is not so important

Of course, I could add sites in IIS to the servers, but there are 1600 instances that will need to be configured, and this will be very time-consuming and difficult to manage.

The ability to configure individual instances on multiple servers, then manage load balancing through the DNS configuration or filter on firewalls that can be easily controlled programmatically.

FYI — Asp.net 4.0 is used and IIS runs on Windows Server 2008.

Any suggestions would be great.

Thank you very much

+4
source share
1 answer

The easiest and most reliable way to do this is to set up individual IIS sites. I know that you do not want to do this, because it will be a very long time and it will definitely be difficult to handle.

However, you have already created a website, so it may be time to create a management tool for instances of this website. Since there are 1600 instances that you want to configure, there is a pretty good chance that you already have data on those 1600 instances that are stored somewhere, such as a database or spreadsheet.

So:

  • Get data on 1600 copies in a convenient format, the Sql Server database (Express or paid for!) Is likely to be ideal.
  • Explore IIS7 Security API s
  • Match a tool that allows you to create all 1600 instances from the data you have about them, automatically / in batches, through the IIS7 API.
  • Maintain and expand the tool for the inevitable changes you will need when you need to add or remove instances.

Do not forget that sharing your tool for such a task gives you great flexibility, although there may be tools for this purpose that deserve attention. For this (i.e., non-software solution) I suggest requesting from http://www.serverfault.com

+2
source

Source: https://habr.com/ru/post/1347874/


All Articles