Skip to content Skip to sidebar Skip to footer

The Wait Operation Timed Out Win32Exception (0x80004005): The Wait Operation Timed Out Azure

Following error comes when retrieving large amount of data from sql azure. I have already implement the Transient Fault Handling but still getting this error Description: An unhand

Solution 1:

The SqlClient.SqlCommand object has a property CommandTimeout. It's default value is 30 (seconds). You should set it to a higher value.


Solution 2:

You can set the timeout value higher or you can turn off the timeout value, as I did in the below code. Note that you may encounter errors if the object that holds the data exceeds 2Gb. You may want to consider redesigning your query to take smaller chunks of data at a time.

// I'm populating an ADO.Net DataTable for this demo but populate whatever object you'd like
DataTable DtFromSQL = new DataTable();
SqlConnection myConnection = new SqlConnection("ConnectionString");
myConnection.Open();
SqlDataReader myReader = null;
SqlCommand myCommand = new SqlCommand("enter some SQL query here", myConnection);
// A CommandTimeout Value of 0 turns the timout off, otherwise you can set it to some value in seconds
myCommand.CommandTimeout = 0;  
myReader = myCommand.ExecuteReader();
DtFromSQL.Load(myReader8);
myConnection.Close();
DtFromSQL;

Post a Comment for "The Wait Operation Timed Out Win32Exception (0x80004005): The Wait Operation Timed Out Azure"