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

后端 未结 11 1004
暗喜
暗喜 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:44

    Use a Web Deployment Project and update the wdproj file (it's just an MSBuild file) with some post build tasks to output the correct .config file. I keep a web.config and web.release.config then use this in the wdproj file:

    
        
        
    
    

    More information

    A simpler solution some like is using configSource property of appSettings and connectionStrings and then never overwriting that file on the production server.

提交回复
热议问题