locked
web.config has wrong connection strings after publishing RRS feed

  • Question

  • User982203039 posted

    I can not figure this out. I have changed SQL servers (new name) and when I look at my web.config file in Visual Studio all the connections are pointing to the correct sql server name. But when I publish a few of the connections point to the old server name. Where would this be pulling the old information from?

    Thanks!

    B

    Tuesday, July 14, 2020 1:43 PM

All replies

  • User475983607 posted

    But when I publish a few of the connections point to the old server name.

    What is a connection point?

    Where would this be pulling the old information from?

    Hard coded connection string(s) within the code base.  The web.config is incorrect.  Your tests are incorrect.

    Tuesday, July 14, 2020 1:56 PM
  • User-474980206 posted

    Some publish tools will not replace a web.config.

    Tuesday, July 14, 2020 2:24 PM
  • User1694748171 posted

    I had this issue before and the reason why when you have old connection string is when you change the connection string you need to re debug it again before you publish it, otherwise it will continue pointing to old connection even if you just change the connection string in web.config.

    Tuesday, July 14, 2020 2:41 PM
  • User982203039 posted

    So I know it is replacing it as I am manually editing the web.conifg after I publish to make these changes.

    Tuesday, July 14, 2020 7:09 PM
  • User1694748171 posted

    Make sure when you replacing the connection string in web config to debug the code again. otherwise it will continue connected to old connection string.

    Tuesday, July 14, 2020 8:44 PM
  • User982203039 posted

    It ended up that I had to edit  LastUsedBuildConfiguration on the Publish page.  The Database Settings were wrong  under settings.

    Thanks all!!

    Tuesday, July 14, 2020 9:09 PM