本文介绍了操作完成之前经过的超时时间或服务器没有响应。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Server上托管了一个数据库。一个存储过程用于在一个表中插入或更新数据。在过程中使用Try Catch Block进行数据存储。对于存储数据使用'用户定义的表类型',此类型也用作存储过程中的输入参数。依赖于数据行,数据将更新或插入。



以下Exception Occure有时用于该过程 -



异常 - System.Data.SqlClient.SqlException(0x80131904):执行超时已过期。操作完成之前经过的超时时间或服务器没有响应。 ---> System.ComponentModel.Win32Exception(0x80004005):等待操作超时

在System.Data.SqlClient.SqlConnection.OnError(SqlException异常,布尔breakConnection,Action`1 wrapCloseInAction)
$ b System.Data.SqlClient.SqlInternalConnection.OnError上的$ b(SqlException异常,Boolean breakConnection,Action`1 wrapCloseInAction)

at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,Boolean callerHasConnectionLock,Boolean asyncClose)

在System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj,Boolean& dataReady)

at System System.Data.SqlClient.SqlDataReader.get_MetaData()
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader) ds,RunBehavior runBehavio r,String resetOptionsString,Boolean isInternal,Boolean forDescribeParameterEncryption)

at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean async,Int32 timeout,Task& task,Boolean asyncWrite,Boolean inRetry,SqlDataReader ds,Boolean describeParameterEncryptionRequest)

在System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String method,TaskCompletionSource`1 completion, Int32超时,任务和任务,布尔& usedCache,布尔asyncWrite,布尔inRetry)

在System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String method)

at System.Data.SqlClient.SqlCommand.ExecuteScalar()

,位于e:\Builds \\中的Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteScalar(IDbCommand命令) EntLib \Latest\Source \Blocks\Data\Src\Data\Database.cs:第476行

at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteScalar(DbCommand命令) )在e:\Builds \ EntLib \ Latest\Source中Blocks \Data\Src\Data\Database.cs:第998行

at PearlSolution.Data.Test_Param_ValueDAC.SaveParameterValue(DataTable dtTestResult,String approveLevelID,String stateIDs,String testregnID)

ClientConnectionId:86f7aed4-1a4c-4662-9d23-413ea828c0a0

错误号码:-2,状态:0,等级:11



我尝试过:



在商店中我更改了更新和插入查询。首先使用cursur存储或更新数据。

之后我改为



更新表1来自表2(用户定义表类型)

从table2插入table1(用户自定义表类型)



但我仍然有同样的错误

I have one Database hosted on Server.for one Store Procedure use to Insert or Update data in One Table.In Procedure use Try Catch Block for Data Store. for Store Data Used 'User Defined Table Type',also this type is used as input parameter in store procedure.depend on data row, data will update or insert.

following Exception Occure sometimes for that procedure -

Exception - System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteScalar(IDbCommand command) in e:\Builds\EntLib\Latest\Source\Blocks\Data\Src\Data\Database.cs:line 476
at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteScalar(DbCommand command) in e:\Builds\EntLib\Latest\Source\Blocks\Data\Src\Data\Database.cs:line 998
at PearlSolution.Data.Test_Param_ValueDAC.SaveParameterValue(DataTable dtTestResult, String approveLevelID, String stateIDs, String testregnID)
ClientConnectionId:86f7aed4-1a4c-4662-9d23-413ea828c0a0
Error Number:-2,State:0,Class:11

What I have tried:

In store Procedure i change Update and Insert Query. first use cursur to store or update data.
after that i change to

update table1 from table 2(User Defined Table Type)
Insert Into table1 from table2(User Defined Table Type)

but still i have this same error

推荐答案



这篇关于操作完成之前经过的超时时间或服务器没有响应。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 15:13