Home
Search

Start | Blogs | IT | Azure uses old database

2020-01-24

IT

Azure uses old deleted database solution

I created a new database on Azure based on a .bacpac file from the production environment for a customer project to use in the dev and uat environments. For the dev environment it kept displaying the old database even though it had been deleted and I had changed the connection string to point to the new database. Locally it worked perfectly to connect to the new database.
At first I only changed the connection string through FTP and then I realized that the connection string under the configuration section in Azure portal overrides the connection string defined in web.config. Changing the connection string there fixed it for the dev environment. This did not help for the uat environment however.

For the uat environment I updated the connection string in the configuration settings, I also updated the connection string through FTP/Azure live edit but to no success. I even created another new database to see if it works, no help there. Worked perfect locally. Restarting the website did not work. But stopping and starting the site did. Thanks to great coworkers who had experienced this issue before I was able to solve it quicker and could cancel the Microsoft support ticket.

Solution:

  1. Create the new database with a new name that has not been used before (should not be necessary but even locally I have had problems with the old database being used if I delete it and restore a new database with the same name as the old one)
  2. Update the connection string under the configuration settings in your Azure web app in the Azure portal.
  3. Stop and then Start the site in the Azure App Service overview section. (Restarting does not help, you have to Stop and then Start).