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?
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.
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.
Member
29 Points
127 Posts
web.config has wrong connection strings after publishing
Jul 14, 2020 01:43 PM|Baze72|LINK
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
All-Star
52971 Points
23571 Posts
Re: web.config has wrong connection strings after publishing
Jul 14, 2020 01:56 PM|mgebhard|LINK
What is a connection point?
Hard coded connection string(s) within the code base. The web.config is incorrect. Your tests are incorrect.
All-Star
58124 Points
15640 Posts
Re: web.config has wrong connection strings after publishing
Jul 14, 2020 02:24 PM|bruce (sqlwork.com)|LINK
Some publish tools will not replace a web.config.
Member
28 Points
133 Posts
Re: web.config has wrong connection strings after publishing
Jul 14, 2020 02:41 PM|luay20032003|LINK
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.
Member
29 Points
127 Posts
Re: web.config has wrong connection strings after publishing
Jul 14, 2020 07:09 PM|Baze72|LINK
So I know it is replacing it as I am manually editing the web.conifg after I publish to make these changes.
Member
28 Points
133 Posts
Re: web.config has wrong connection strings after publishing
Jul 14, 2020 08:44 PM|luay20032003|LINK
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.
Member
29 Points
127 Posts
Re: web.config has wrong connection strings after publishing
Jul 14, 2020 09:09 PM|Baze72|LINK
It ended up that I had to edit LastUsedBuildConfiguration on the Publish page. The Database Settings were wrong under settings.
Thanks all!!