C# ASP.Net: Exception (some times only) during long database operation

前端 未结 2 1379
执念已碎
执念已碎 2021-01-17 01:55

We have a ASP.Net web application that connects to its business layer using WCF. Sometimes, I am getting exception when it is performing a huge operation. The interesting pa

相关标签:
2条回答
  • 2021-01-17 02:26

    The problem is likely that the connection to the SQL Server times out - the default timeout for both connections and commands is 30 seconds.

    You can either up the timeout (on the connection string and in code) or break up the updates into chunks.

    0 讨论(0)
  • 2021-01-17 02:28

    Thanks Oded for patiently answering my questions. My problem got resolved when I splitted the huge database operations into small batches (after configuring MSDTC).

    During Large Database operations, insufficient memory error may come. But this error may not be visible if it is inside a Transaction.

    1) Remove transaction and see if “Insufficient Memory” exception is available.

    2) Breakdown large database operations into small batches to remove the “Insufficient Memory” exception

    3) Configure MSDTC in app tier and database

    4) Ensure that WCF does not time out abruptly. It should have enough time based on database operations.

    5) Observe the behavior when the database server is restarted (This is last option)

    Some useful information available in

    There is insufficient system memory in resource pool 'default' to run this query

    MSDTC Exception during Transaction: C#

    C# ASP.Net: Exception (some times only) during long database operation

    SQL Server 2005 Error 701 - out of memory

    Some other checks:

    1) Whether the windows account under which the database engine is running have "Lock pages in memory permission"?

    2) Chek SQL Sever service pack version.

    3) Check size of virtual memory paging file

    4) Check max server memory

    5) Determining MemToLeave Settings

    6) "SQL Server Memory Configuration and MemToLeave"

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