Change connection string from development to production when publishing

后端 未结 4 1116
野性不改
野性不改 2021-01-13 09:03

I want to know how to change automatically the connection string of my app so when I\'m working on it in my pc, it uses my local SQL Server and once I publish it then uses t

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-13 10:03

    The two configs are built for their respective build setting, so you can put your dev connection string in Web.Debug.config and your prod connection string in Web.Release.config. Then, when you deploy to production, run a Release build and your resulting Web.Config will have the production connection string.

提交回复
热议问题