connection string in publish profile is empty

WASIM 1 Reputation point
2022-10-14T16:35:02.547+00:00

I have an app service and SQL server databse in azure but when I download the publish profile the database connection string is empty can I know why or how to fix it

Azure SQL Database
Developer technologies ASP.NET ASP.NET Core
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2022-10-17T06:18:57.373+00:00

    Hi @WASIM

    From your description, you should currently only have the database connectionstring configured in the project appsettings.json or web.config.

    The database connection connection information is not configured in the following figure (azure portal and visual studio2019/2022).

    250973-image.png

    250887-image.png

    So when you downloaded the publish file, it will not contain the connectionstring details.

    In App Service, configurations in the Azure portal take precedence over file configurations in your project, so it doesn't matter if you're using a database connection string from a test environment when publishing. As long as you make sure Azure Portal has a connection string for your production environment, the settings in Azure Portal will be automatically used after publishing.


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,
    Jason

    0 comments No comments

  2. Ali Sufyan Butt 86 Reputation points MVP
    2022-10-17T06:24:43.79+00:00

    From application settings, add connections strings, then it will appear only.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.