Skip to content

Database MySQL Connection Timeout on Northwind Database creation during site initialization

Victor Tomaili edited this page May 3, 2021 · 1 revision

You might receive the following error when starting serenity using a MySQL database .

System.Data.MySqlClient.MySqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

Don't panic there is a very simple solution to the problem.

Goto your folder named: App_Start

Find the file named SiteInitialization.Migrations.cs

You will see code that looks like this:

var runner = new RunnerContext(announcer)
{
    Database = databaseType,
    Connection = cs.ConnectionString,
    Targets = new string[] { typeof(SiteInitialization).Assembly.Location },
    Task = "migrate:up",
    WorkingDirectory = Path.GetDirectoryName(typeof(SiteInitialization).Assembly.Location),
    Namespace = "MyProject.Migrations." + databaseKey + "DB",
    Timeout = 90
};

In the code above take notice of the line with Timeout = 90 add that in to your code and set the time out in seconds , also please note the line above it must now get a comma at the end of the line right after "DB" in order to compile. That is all there is to it - like magic.

Clone this wiki locally