Installation and deployment Questions on installation, system configuration and deployment to the live server.
Version 5.x > Installation and deployment > ConnectionString Name Issue View modes: 
User avatar
Member
Member
kentico-bytix - 11/12/2012 3:15:48 AM
   
ConnectionString Name Issue
Dear Developers...

I've got a question for you:

We have multiple Kentico Installations in different versions. We are currently building our new Dev-Staging-Live Environment.

Now for usability reasons we want the connection strings outsourced in a new file called ConnectionStrings laying in the following folder:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG
This file will be referenced by the Machine.config.

So now to my question... how can i solve the issue with the same names? All Connection strings are called CMSConnectionString....

How can i rename them in the CMS without have to reinstall. Or is there a possibility to refer a ConnectionString. E.g.:

This is an example ConnectionString:
<add name="CMSConnectionString" connectionString="Persist Security Info=False;database=DATABASE;server=SERVER;user id=XXX;password=YYY;Current Language=English;Connection Timeout=240;" />

Is there a possibility to do something like this:
<add name="CMSConnectionString" ReferrConnectionString="XXXConnectionString1"/>

We need a solution for this... Is there an easy ability to change the connection string in the CMS?

Thanks for your help...

Regards
Patrick

User avatar
Kentico Support
Kentico Support
kentico_radekm - 11/15/2012 6:10:34 AM
   
RE:ConnectionString Name Issue
Hello.

We were solving this issue in support ticket and I have suggested some workaround there. If you find any of that functional or if you have any other solution, you may share it with other users here. Thank you.

Best Regards,
Radek Macalik

User avatar
Member
Member
kentico-bytix - 11/15/2012 6:38:22 AM
   
RE:ConnectionString Name Issue
Dear Radek...

First of all thanks for your Help/Ideas...

As i had to accept that there was no way to change the Connection Strings name, Radek pointet me out a good iead for my problem.

This was my question to Radek:

Well our goal is the following:

We are starting to use TFS…

Imagine you have Dev-Staging-Live environment.

If someone is working on dev and has settings to do in web.config, then he does the changes he has to do and checks it in.

On the day before GoLive we Merge all the changesets that are defined to go live to Staging. And here ist he problem… if in the Changeset the Web.Config file is, then the ConnectionString from the Development environment would also get merged…

If we could outsource them by a name (which i think would not be a big problem in the installation phase of the project), then we could create a DevConnectionsStrings.config a StagingConnectionStrings.config and a LiveConnectionStrings.config file and deploy them on the servers… and nobody would have to bother about connection strings anymore…

And his answer made me rethink:

Radeks Partial Answer:
In this case, you could use inheriting the web.config files in a way, that the web.config will be defined in web site’s root and particular applications will inherit it, like:

/inetpub/wwwroot/web.config with connectionString
/inetpub/wwwroot/app/web.config – without connectionString and /clear element.

And my Final Solution will be that i will Create a ConnectionFile for each CMS.

As en example:
My CMS Customer is Called Foo.

I am going to create a FooConnectionString.config File laying in the folder:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG

containing:
<connectionStrings>
<add name="CMSConnectionString" connectionString="Persist Security Info=False;database=Foo;server=SERVER;user id=USER;password=PASSWORd;Current Language=English;Connection Timeout=240;" />
</connectionStrings>

And in the Web.Config i just set the
<ConnectionStrings configSource ="C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\FooConnectionString.config" />

And the magic is if on the Staging and Prod servers the same files are laying then no one has to bother about connection strings on the desired environments anymore...

Hope i could help anyone...

Regards
Patrick