Timeout expired. The timeout period elapsed prior to completion of the operation or the server..., elapsedserver ..

Source: Internet
Author: User

Timeout expired. The timeout period elapsed prior to completion of the operation or the server..., elapsedserver ..

Problem:

Recently, the program always throws the following exception:

An exception of type 'System. Data. SqlClient. SqlException 'occurred and was caught.

----------------------------------------------------------------------------------

Type: System. Data. SqlClient. SqlException, System. Data, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089

Message: Timeoutexpired. The timeout period elapsedprior to completion of the operation or the server is not responding.

Source:. Net SqlClient Data Provider ......

...... Database. ExecuteReader (DbCommandcommand )......

Data Reading times out.

Then I checked the corresponding tables in the DataBase and found that the table structure is simple, but the data volume is large, with hundreds of thousands or millions of entries. Check whether you have created Indexes/Keys.


Solution:

Based on the table structureUnique key under Indexes/Keys, Similar to the following:

ALTER TABLE [dbo].[ZData] add  CONSTRAINT [IX_ZData] UNIQUE NONCLUSTERED ([Pid] ASC,[EntryID] ASC,[Date] ASC)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]GO
Test, found that the speed is much faster, reduce the risk of timeout.





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.