Geeks With Blogs
BizTalk Blog by Chris Han System Design for Enterprise Agility,
I've been through almost all sorts of Timeout related issues with Asp.net web service development. I’d like put a check list here to remind myself and hopefully save some headache of yours.
 
  1. If use database, you may get ‘System.Data.SqlClient.SqlException: Timeout expired’:
          a: Check your connection string setting for ‘Connect Timeout’:  I.e.
    connectionString="Data Source=SNYC14D11511;Initial Catalog=d_dbivt003;Persist Security Info=True;User ID= user;Password= Password;Connect Timeout=4200

          b:Check your command object  SqlCommand.CommandTimeout Property, it’s by default 30s 
  2. Check you Web.config setting when you get error like ‘Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.’:
    <system.web>….
    <compilation debug="false"/>
    <httpRuntime executionTimeout="1200"/>
    </system.web>
    make sure your set 'compilation debug="false" as well to let timeout setting take effect. Check MSDN for details.
  3. Set your proxy class Timeout property (derived from WebClientProtocol.Timeout Property) at client if you get error like this ‘The operation has timed out’: I.e.
    proxy.Timeout = System.Threading.Timeout.Infinite;
  4. If you are like me, use VistualStudio unit test tool and you get a blue icon and error ‘Timeout’ in your test result pane, you need to check your test config file localtestrun.testrunconfig. The last item ‘Test Timeouts’ is the key. It’s 5 min by default. 
  5. Last one and every web developer should know is the IIS server setting such as Keep Alive and Connection Timeout
Posted on Wednesday, July 18, 2007 4:50 PM Asp.Net 2.0 | Back to top


Comments on this post: Timeout Asp.net - What could possibly go wrong?

# re: Timeout Asp.net - What could possibly go wrong?
Requesting Gravatar...
thank you so much! you have solved a problem we've been struggling with for months ;-)
Left by Mel on Aug 29, 2007 1:19 AM

# re: Timeout Asp.net - What could possibly go wrong?
Requesting Gravatar...
You are welcome. Glad it helps.
Left by Chris on Aug 29, 2007 8:15 AM

# re: Timeout Asp.net - What could possibly go wrong?
Requesting Gravatar...
Hi,
This looks good. I could not try yet and i have a question. :)
Does this work with proxies that i can not configure and got many timeouts? I wrote an interface for customer support team which connects to a oracle database and runs a huge querry takes time about 1 hour. and of course i got timeout. does this helps to me ? :))
Left by Mersin Ayyildiz on Nov 26, 2007 5:37 PM

# re: Timeout Asp.net - What could possibly go wrong?
Requesting Gravatar...
great, thank you so much.
Left by cm on Dec 02, 2008 4:31 PM

# re: Timeout Asp.net - What could possibly go wrong?
Requesting Gravatar...
Hi Geek,

Can some pls help me in this problem ?

My Web application has timeout set to 90 sec(which is default) and the DB commandtimeout changed to 90 sec (default is 30 sec) , if my application runs more than 90 sec i get the Timout error from DB, so i increased the DB timeout to 200 sec, now the query works fine, but what is the purpose of the web request timeout which is 90 sec ?

Actally speaking when the request takes more than 90 sec it shd through me an error ? right ?

Note : The application is publised and not in debuig mode.
Left by Maria on Jan 13, 2009 8:56 AM

# re: Timeout Asp.net - What could possibly go wrong?
Requesting Gravatar...
Maria,

I assume the 'Web application time' you are talking about is 'executionTimeout'. 90 sec default is only applying to .net 1.0 and 1.1. It has been changed to 110 sec in 2.0 and above. Did you specify it explicitly or leave it as default?
Left by Chris Han on Jan 13, 2009 10:07 AM

# re: Timeout Asp.net - What could possibly go wrong?
Requesting Gravatar...
Users on website get logged out at about 90 seconds. Any suggestions to cure this?
App runs under asp.net3.5
Not aware of any clever code to reset tickets, nor of any overrides in lower level folders.
Specific questions:
1) Are there any more places one can set any timeout/ expiry values?
2) Might the machine.config override whatever is in the app's web.config file?
App's web.config (in www root folder) has:

<system.web>
<sessionState
timeout="45"
/>
....
<authentication mode="Forms">
<forms
slidingExpiration="true"
timeout="45">
</forms>
</authentication>
...
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="45">
<providers>
<clear />
<add
name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="ConnectionString"
applicationName=""/>
</providers>
</membership>
...
</system.web>

Thanks for any help you can give
Left by michael on Mar 04, 2009 10:04 AM

# re: Timeout Asp.net - What could possibly go wrong?
Requesting Gravatar...
We have a C#.Net application where in, it tries to insert a record to the Sql server 2000 database table but occasionally and randomly getting the following error "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."

Is the enough to set the command timeout property to a higher level ? or else anything also to be taken care.
Please advice as this issue is going on for months :-(

Thanks,
Karthik
Left by Karthik on Jul 30, 2009 4:16 AM

# re: Timeout Asp.net - What could possibly go wrong?
Requesting Gravatar...
I haven't had a change looking into your case. But if it is only happening occasionally, I suggest you check the SQL server side first. If you can find a way to reproduce the error, check the list I posted above one by one starting from the SQL end. Good luck.
Left by chris on Jul 31, 2009 11:51 AM

# re: Timeout Asp.net - What could possibly go wrong?
Requesting Gravatar...
Hi,
We have a C# .Net Application where in, we try to insert 1200 - 2000 rows into a SQL Server 2000 database table which already has huge number of records, we get an error saying "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."

I had tried setting command timeout and connection time out to a higher value. What ever is the value the error is being thrown in 30 - 40 secs. Could you please throw some light on resolving this issue? We have been facing this issue since long..Could you please advise?
Left by Ravi on Aug 13, 2009 5:12 AM

# re: Timeout Asp.net - What could possibly go wrong?
Requesting Gravatar...
Thankyou very much :)
Left by Madhu on Dec 30, 2010 6:13 AM

# re: Timeout Asp.net - What could possibly go wrong?
Requesting Gravatar...
Very useful information at one place. Thanks!
Left by KR on Jan 10, 2012 10:21 AM

Your comment:
 (will show your gravatar)


Copyright © Chris Han | Powered by: GeeksWithBlogs.net