.NET -> MySql random connection issues

bob housedorf 0 Reputation points
2025-02-20T00:30:54.8833333+00:00

Random, and rarely, our .NET app running on Azure gets connection errors as follows.

We're running MySql 5.7 ( yes, we know ... )

FYI, the app has almost no error handling, and no logging.

We inherited this app.

Here is the error returned from Application Insights, as stated all errors seem to be from READs:

Fatal error encountered during command execution. Fatal error encountered attempting to read the resultset. Reading from the stream has failed. Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. 

The data access for the entire app is THE most basic.
Razor pages with embedded SQL, and here is the entire DA code:

using Dapper;

using MySql.Data.MySqlClient;

using System;

using System.Collections.Generic;

using System.Data;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace DataLibrary

{

public class DataAccess : IDataAccess

{

public async Task<List<T>> LoadData<T, U>(string sql, U parameters, string connectionString)

{

using (IDbConnection connection = new MySqlConnection(connectionString))

{

var results = await connection.QueryAsync<T>(sql, parameters);

return results.ToList();

}

}

public Task SaveData<T>(string sql, T parameters, string connectionString)

{

using (IDbConnection connection = new MySqlConnection(connectionString))

{

return connection.ExecuteAsync(sql, parameters);

}

}

}

}

Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
909 questions
{count} votes

1 answer

Sort by: Most helpful
  1. bob housedorf 0 Reputation points
    2025-02-21T20:08:52.93+00:00

    I DID respond with more details.

    0 comments No comments

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.