comment connecter MySQL et EF Core ?
Unable to connect to MySQL in app from ASP.NET Core Blazor app deployed in Azure app service
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
2 answers
Sort by: Most helpful
-
-
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