Our application uses a config file to store connection strings. For live this is just 2 lines. For localhost we have over 300 lines, for 150+ servers, and every time we want to change servers we have to comment out the currently active one and uncomment the one we want.
I have just set this up so that I can go to http://localhost/hm01/<clientname>.asp
and it will automatically pick up the config as follows:
<servers>
<server name="hm01">
<setting name="connectionstring_ado" value="..." />
<setting name="connectionstring_primary" value="..." />
</server>
</servers>
Obviously there would be a total of around 150 server
elements, each with a different name.
I am using an application called hm01
. On session start this sets application("connectionstring") = getconnectionstring("hm01")
, having detected that /hm01/
is in the URL.
The problem comes when I view two sites at the same time. The latter overrides the former, which invalidates the former - i.e. client 1 is not on the server of client 2 - so client 1 breaks on the next page load.
What I'd like to do is separate out the application objects - so site 1 has a different application object to site 2. I have read that this may be possible with different application pools. I will already have to set up 150 applications in IIS - I really don't want to have to create 150 application pools too so I don't think this is a way forward. Besides not only would I have to set this up but over 50 other developers would too. I don't believe application pools and applications can be exported, and even if they could some developers have the client files in different locations.
Does anyone have any suggestions for how we could achieve an efficient localhost setup with the following features, efficiently:
- Easy to use a particular server just by going to http://localhost/<servername>/<clientname>
- Easy to maintain - perhaps sharing configuration for IIS between many developers
- Easy to extend - for example adding, editing or removing servers
Regards, Richard