nerdexam
Microsoft

AZ-204 · Question #94

You develop and deploy an ASP.NET Core application that connects to an Azure Database for MySQL instance. Connections to the database appear to drop intermittently and the application code does not ha

The correct answer is A. Increase connection repeat attempts exponentially up to 120 seconds. C. Wait five seconds before repeating the connection attempt to the database. E. Set a maximum number of connection attempts to 10 and report an error on subsequent connections.. The first and second case are fairly straight forward to handle. Try to open the connection again. When you succeed, the transient error has been mitigated by the system. You can use your Azure Database for MySQL again. We recommend having waits before retrying the connection. Ba

Submitted by miguelv· Mar 30, 2026Monitor, troubleshoot, and optimize Azure solutions

Question

You develop and deploy an ASP.NET Core application that connects to an Azure Database for MySQL instance. Connections to the database appear to drop intermittently and the application code does not handle the connection failure. You need to handle the transient connection errors in code by implementing retries. What are three possible ways to achieve this goal? Each correct answer presents part of the solution. NOTE: Each correct selection is worth one point.

Options

  • AIncrease connection repeat attempts exponentially up to 120 seconds.
  • BClose the database connection and immediately report an error.
  • CWait five seconds before repeating the connection attempt to the database.
  • DDisable connection pooling and configure a second Azure Database for MySQL instance.
  • ESet a maximum number of connection attempts to 10 and report an error on subsequent connections.

How the community answered

(31 responses)
  • A
    84% (26)
  • B
    6% (2)
  • D
    10% (3)

Explanation

The first and second case are fairly straight forward to handle. Try to open the connection again. When you succeed, the transient error has been mitigated by the system. You can use your Azure Database for MySQL again. We recommend having waits before retrying the connection. Back off if the initial retries fail. This way the system can use all resources available to overcome the error situation. A good pattern to follow is: - Wait for 5 seconds before your first retry. - For each following retry, the increase the wait exponentially, up to 60 seconds. - Set a max number of retries at which point your application considers the operation failed. https://docs.microsoft.com/en-us/azure/mysql/single-server/concepts-connectivity

Topics

#transient errors#retry logic#exponential backoff#Azure Database for MySQL

Community Discussion

No community discussion yet for this question.

Full AZ-204 Practice