How do you deal with connection strings when deploying an ASP.NET site?

后端 未结 11 1003
暗喜
暗喜 2021-02-04 13:51

Right now our test and production databases are on the same server, but with different names. Deploying has meant editing Web.config to change all the connection strings for th

11条回答
  •  悲&欢浪女
    2021-02-04 14:41

    I create a database alias on each server to point to the database. I then use this alias in my web.config files. If I need to change which database the application points to, then I change the alias and not the web.config.

    For SQL Server, go to SQL Server Configuration Manager > SQL Native Client Configuration > Aliases > Create New Alias.

    You can do the same thing with Oracle with the tnsnames file.

提交回复
热议问题