The timeout period has expired. The timeout has expired before the operation completes or the server is not responding "
Preliminary analysis of the reason for the MSSQL operation when the connection time-out, know that the matter, not noticed before, probably in the configuration file set the connection time limit, find the next solution on the net, mostly said in the database connection string to solve
SqlConnection con = new SqlConnection ("server=.; Database=mydb;uid=sa;pwd=password; ")
Switch
SqlConnection con = new SqlConnection ("server=.; Database=mydb;uid=sa;pwd=password; Connect timeout=500 ")
Seems to have no effect. Still running for 30 seconds to report timeout!
Suddenly it seems that it should be possible to specify in the connection database code that the property of the con is connectiontimeout,
SqlConnection con = new SqlConnection ("server=.; database=mydb;uid=sa;pwd=; ");
Con. ConnectionTimeout = 180;//Error, property ConnectionTimeout is read-only!
Try to fail, then look at the Command object properties and find that it has similar properties! CommandTimeout set up a bit:
SqlCommand cmd = new SqlCommand ();
Cmd.commandtimeout = 180;