Difference between command timeout and connection time out

前端 未结 2 1983
一整个雨季
一整个雨季 2021-01-20 16:57

What is the difference between connection timeout and command timeout?

In our application sometimes it is showing a timeout error. When we increased the command time

相关标签:
2条回答
  • 2021-01-20 17:27

    As mentioned connection timeout is timeout for establishing connection with DB server. Command timeout is timeout for command execution.

    Extending command timeout is possible but when doing this in ASP.NET you should be also aware of request execution timeout. You can set it in code via Server.ScriptTimeout or globally in httpRuntime/@executionTimeout. Default value for .NET 2.0+ is 110s.

    But generally this is most probably wrong way to architect application. Unless you are doing some heavy online reporting wich will be rarely executed no one will want to use it.

    0 讨论(0)
  • 2021-01-20 17:36

    ConnectionTimeout is the time your code should wait when trying to open the connection to the DB

    CommandTimeout is the time your code should wait for your SQL code to execute.

    If you're hitting command timeout your SQL is taking a long time to execute, so you may want to check your query. If your query is optimized, then raising the command timeout may be the only thing to make your client work.

    0 讨论(0)
提交回复
热议问题