Last post Mar 03, 2011 09:12 AM by bbcompent1
Mar 03, 2011 05:25 AM|yorky001|LINK
Have a query that takes approx 30 seconds to execute when run from sql server management studio (sql2005), however when
I execute this query from a .net page using enterprise libray it times out after approx one minute. The connection timeout on
the sql connection string is 600 seconds.
Does anyone know how I can set a timeout for this?
The code below shows the C# code
public IEnumerable<CustomerList> GetCustomerList(CustomerEntity ce)
ParameterMapper pm = new ParameterMapper(new List<String>()
"@CustomerID", "@FirstName", "@LastName", "@Organisation",
"@Address", "@CountryCode", "@PostCode", "@InvoiceNumber", "@CompanyCode"
DataAccessor<CustomerList> customerAccessor = this.db.CreateSprocAccessor(
.Map(x => x.ReformattedRefNo).ToColumn("ReformattedRefNo")
.Map(x => x.ReformattedAddress).ToColumn("ReformattedAddress")
.Map(x => x.CountryCode).ToColumn("COUNTRY_CODE")
catch (SqlException sqlEx)
// Log this
Mar 03, 2011 09:07 AM|bbcompent1|LINK
Never mind, didn't realize you already had a connection timeout set. Does your debugger give you any messages?
Mar 03, 2011 09:12 AM|bbcompent1|LINK
Take a look at this: http://forums.asp.net/t/903456.aspx/6/10
"I would say that setting Connection timeout in web.config and CommandTimeout of the SqlCommand object are right points but one more thing should be set beside that - this is the executionTimout of the requiest. If the execution timout is smaller than the
connection timout you will not be able to get the response incuding the results. So set the execution timeout this way:
The timeout is defined in seconds so set it appropriate for you.The httpRuntime element is located in system.web."