Publicación de IIS en un servidor diferente eligiendo una cadena de conexión dedicada

In my asp.net website i have multiple connectionstring in web.config. I need to pick a connection string when i publish on my local server for test, and the other one when I have to publish on "real server" when i need to release.

<!-- LOCAL SQLEXPRESS -->
<add name="LocalConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=TimeLive;Persist Security Info=True;User ID=*********;Password="*********" providerName="System.Data.SqlClient"/>
<!-- IPR-GEST SQLEXPRESS  -->
<add name="ServerReleaseConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=TimeLive;Persist Security Info=True;User ID=*********;Password=*********" providerName="System.Data.SqlClient"/>

Since the two connectionString differs from user login, I thought it's possible changing server authentication switching to "Windows Authentication", but sounds like less secure. Am I wrong?

How can I choose the right connectionString depending on I publish on local or release server?

Also, the solution contains a dll project with a .dbml file. Same problem: two different connectionString, one for each server. Is there a simple way to choose the right one?

preguntado el 12 de junio de 14 a las 11:06

Windows authentication is even more secure than SQL logins, from the point of view that the passwords are not stored anywhere. -

1 Respuestas

Depending which version of Visual Studio you have, it has Web.config File Transformations, it allows you to have a configuration template for development and another for production.

http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/web-config-transformations

Respondido el 12 de junio de 14 a las 11:06

Thank you! I'm going to studying trasformations. Seems it could be useful for my task. - insilenzio

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.