Macko
Macko

Reputation: 966

Pomelo MySql .net core 2 - default execution timeout

we are using Pomelo MySql in production environment for half a year and it works just fine but occassionally we are getting exception like so:

MySql.Data.MySqlClient.MySqlException: The Command Timeout expired before the operation completed.

Connection string in appsettings.json looks like this:

"MySqlConnection": "server=somesql;userid=user;password=pass;database=test;"

so nothing fancy.

My question is what is the default command execution timeout in pomelo? How can I change it through connection string?

Executing code like this inside DbContext

var timeout = Database.GetCommandTimeout();

gives me always null value.

Upvotes: 4

Views: 2108

Answers (1)

Aministrator
Aministrator

Reputation: 95

Try increasing the command timeout (in seconds) in your connection string by specifying default command timeout.

In your case your connection string should look like:

server=somesql;userid=user;password=pass;database=test;default command timeout=120;

Upvotes: 8

Related Questions