0

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

ClarkeyBoy
  • 4,934
  • 12
  • 49
  • 64
  • Does it have to be in the Application? Can you read it each time it's used? – G. Stoynev Mar 25 '13 at 06:04
  • @G.Stoynev Thanks for your reply. We actually managed to resolve this this morning - turns out that the applications were using different connection strings as required, but all applications were sharing the same cookie (which is used for security reasons). Changing the security cookie meant that it invalidated any other applications so we're still, unfortunately, limited to just 1 connection to 1 server at a time :(. – ClarkeyBoy Mar 25 '13 at 10:51

0 Answers0