BizTalk Blog by Chris Han

System Design for Enterprise Agility,

  Home  |   Contact  |   Syndication    |   Login
  65 Posts | 9 Stories | 122 Comments | 79 Trackbacks

News

Article Categories

Archives

Post Categories

Image Galleries

BizTalk Bloggers

BizTalk on MSDN

Patterns & Architecture

SharePoint

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

Feedback

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

# re: Timeout Asp.net - What could possibly go wrong? 8/29/2007 8:15 AM Chris
You are welcome. Glad it helps.

# re: Timeout Asp.net - What could possibly go wrong? 11/26/2007 5:37 PM Mersin Ayyildiz
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 ? :))

# re: Timeout Asp.net - What could possibly go wrong? 12/2/2008 4:31 PM cm
great, thank you so much.

# re: Timeout Asp.net - What could possibly go wrong? 1/13/2009 8:56 AM Maria
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.

# re: Timeout Asp.net - What could possibly go wrong? 1/13/2009 10:07 AM Chris Han
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?


# re: Timeout Asp.net - What could possibly go wrong? 3/4/2009 10:04 AM michael
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

# re: Timeout Asp.net - What could possibly go wrong? 7/30/2009 4:16 AM Karthik
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

# re: Timeout Asp.net - What could possibly go wrong? 7/31/2009 11:51 AM chris
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.

# re: Timeout Asp.net - What could possibly go wrong? 8/13/2009 5:12 AM Ravi
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?

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: