Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We've had to come up with a solution at work to do day-time releases of our intranet application whilst maintaining 100% uptime. This is because we do builds during the day with high-priority bug fixes that have to go out on the same day.

An option suggested to me was using network load balancing with two sites on the same server, which is really a great solution for our needs (we can't afford another server with the same hardware, they're £5k+ for our setup).

So I've taken a look at this article where it states the following:

For session state to be maintained across different web servers in the web farm, the application path of the website (for example. \LM\W3SVC\2) in the IIS metabase should be identical in all the webservers in the web farm.

This is a problem as the application paths will have to be different if the same website is NLB'd on the same server. We need to maintain session state across the two sites (as opposed to web servers) otherwise we'll be flooded with calls from angry users.

So can we set up two sites, on one server that uses NLB and can maintain all state? The sites are identical by the way, just one will be more of a recent build for bugfixes.


So following this I had a hunt around to find this article. It describes issues around the use of the SQLServer option in sessionState in your web.config. It works just fine, except for one thing; session data is not being stored anymore, which breaks all security for us. In Session_Start of my Global.asax file I have some DB-calling code which sets session data which is used throughout the intranet site for quick access to user details.

<sessionState mode="SQLServer" sqlConnectionString="Data Source=localhost;Integrated Security=True" />

Is it because of the DB-access issues or because of the sessionState?


Okay, I figured I hadn't restarted the web service after playing around with the authentication which caused it to break. So the last thing I need to know how to do is switch between the websites whilst whilst pointing at the same location. So say we had a URL of http://mycompanyintranet/ that pointed to the "CompanyIntranet1" and we also had a site of "CompanyIntranet2" in IIS, how would we get http://mycompanyintranet/ to point to "CompanyIntranet2"?

share|improve this question

migrated from Oct 12 '09 at 11:20

This question came from our site for professional and enthusiast programmers.

Interesting problem you have there. Maintaining session states within a web farm is targeted at 2 or more physical servers. For your case, it is one physical server. Will be interesting to see the answers here. – o.k.w Oct 12 '09 at 11:16
up vote 1 down vote accepted

Load balancing is not probably best solution. With session state on SQL Server with this modification you can share session between applications. Then you can make web site on IIS with two application folders. With simple HttpModule you can switch between them as you want.

share|improve this answer
How would the HttpModule work exactly? – Kezzer Oct 12 '09 at 12:50
That refers to this kb The question is, can you "hit the button" to switch sites which allow it to work? – Kezzer Oct 12 '09 at 13:14
With http module you can e.g. catch BeginRequest event and in method you can decide to which application redirect the request. You can also make a static (or application) variable which will indicate this. HttpModule is de facto a class derived from iHttpModule interface and registered in web.config in <system.web><httpModules> section (in IIS7: <system.webServer><modules> section) : – remunda Oct 12 '09 at 16:33
What if I just change the folder in IIS in the web site properties (Home Directory tab)? It seems instantaneous and the URL will be exactly the same just pointing to a different application. So I just change the local path from InetPub to InetPub2, each contains the same application, just one more up-to-date than the other. – Kezzer Oct 13 '09 at 8:07
There are more solutions. You can also make two websites and with powershell script you can change only bindings to web that you want to switch to. – remunda Oct 13 '09 at 8:53

Have you thought about running the sites in virtual machines on the same server? This will mean that the sites can't interfere with each other, loadbalancing and shared state can work in a more standardised manner, and if you get a budget to run 2 machines it will be easy to move it across to a different physical server.

share|improve this answer
No can do, VM's aren't allowed in this case. I think they're fine, others do not for our requirements so I don't have the option whatsoever, despite it being the most logical decision. – Kezzer Oct 12 '09 at 12:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.