Why can my developement app connect to db, but not my deployed app?

Martin 0 Reputation points
2023-12-25T19:00:58.87+00:00

I am new to azure. I am using a blazor wasm app, .net 7. From my local machine, I can connect to my deployed database from both my app and azure studio. But my deployed app cannot connect, the log says the connection is a null reference. I tried setting all existing ip addresses permission in the firewall. I checked the connection string with a log and its exactly the same as what azure is telling me to use. I set the connection string explicitly in appsettings.json.

Developer technologies | .NET | Blazor
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
SQL Server | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-12-27T03:46:48.5466667+00:00

    Hi @Martin,

    Empirically, this issue is not related to Azure Web App or asp.net Core.

    If you're using a database in a VM, make sure you can access it in VS2022 by ip or domain name, not 127.0.0.1 or localhost. Then following the steps below to get the correct connectionstring.

    enter image description here

    enter image description here

    enter image description here

    enter image description here

    enter image description here

    If you are using azure database, please make sure you have enabled the firewall rules, and get the connectionstring as above.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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

Your answer

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