Probable Timeout problems in ASP.NET

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'.’:
    ….

    executionTimeout="1200"/>

    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

Comments

Popular posts from this blog

ASP.NET Compillation Error BC31007 - Solution

The Difference between GET and POST

Test & Debug WCF service using WCFTestClient.exe