Timeout Asp.net - What could possibly go wrong?

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 

  1. 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>….

<httpRuntime executionTimeout="1200"/> </system.web> make sure your set 'compilation debug="false" as well to let timeout setting take effect. Check MSDN for details.

  1. 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;

  2. 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. 

  3. Last one and every web developer should know is the IIS server setting such as Keep Alive and Connection Timeout

This article is part of the GWB Archives. Original Author: Chris Han

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.