Unable to connect to MySQL in app from ASP.NET Core Blazor app deployed in Azure app service

Sathya Narayanan 1 Reputation point
2022-12-01T05:52:17.263+00:00

I have my ASP.NET Core Blazor app in Azure app service. This app uses a MySQL DB.

I am trying to use MySQL in app feature in Azure app service.

Below if the connection string in appsettings.json

"DefaultConnection": "Server=xxxxx.azurewebsites.net;Port=50016;Uid=myUserIdGotFromMySQL.INI;Pwd=myPwdGotFromMySQL.INI;Database=test1;SslMode=none;default command timeout=0;"

Below is the error when I open the web page that fetches data from DB:

MySqlException: Connect Timeout expired.
MySqlConnector.Core.ServerSession.OpenTcpSocketAsync(ConnectionSettings cs, ILoadBalancer loadBalancer, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in ServerSession.cs, line 1129

Any help would be gratefully acknowledged.

TIA

Developer technologies | .NET | Blazor
Azure Database for MySQL
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. KAMBOU OLLO DIDIER 0 Reputation points
    2023-09-13T09:13:23.4933333+00:00

    comment connecter MySQL et EF Core ?

    0 comments No comments

  2. Sathya Narayanan 1 Reputation point
    2022-12-01T08:21:54.603+00:00

    I switched off the 'HTTPS ON' option (in app service configuration) and also changed server to '127.0.0.1' in conn string. Now the app is able to connect to DB.

    Thanks


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.