I have a small database used for a C# WinForms with Mysql Net Connector. All worked well during localhost development but when I moved it to a GoDaddy hosting I started getting 'ContextSwitchDeadlock'. I suspect this is because the server is rejecting the new connections as the programs starts okey and open the first connection but as I try to recover data from it, it stops responding. I use this main schema in most of the forms.
try
{
Using(MySqlConnection Connection = new MySqlConnection("ConnectionString"))
{
Connection.Open();
//Fetching Data putting in Combobox,Textbox,DatagridView etc.
}
}
catch(MySqlException ex)
{
//Handling
}
This is in most forms OnLoad event, so each time a form is opened a new connection is opened. Im aware of Connection pooling so I opened a connection in the main form and in the next one I did just
Using(MySqlConnection Connection = new MySqlConnection())
{
Connection.Open();
}
I also disabled the exeption in the debugger options but it just no longer fetch data after some queries.