小编Jas*_*ind的帖子

实体框架4存储过程调用时间输出

我有一个导入EF4的存储过程,当我在30秒后用某些参数调用它时会抛出超时错误.在SQL Server探查器中,我可以看到存储过程调用使用适当的参数只需要超过30秒,这是我的应用程序的超时.

但是,当我执行在查询分析器中发送到探查器的相同SQL时,它会执行亚秒级.什么可能导致从EF调用和从SQL Server Management Studio调用之间的这种差异?

下面是.NET错误的完整堆栈跟踪.

[SqlException(0x80131904):超时已过期.操作完成之前经过的超时时间或服务器没有响应.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception,Boolean breakConnection)+2073486
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,Boolean breakConnection)+5064444
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()+234
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj)+2275
System.Data.SqlClient. SqlDataReader.ConsumeMetaData()+ 33
System.Data.SqlClient.SqlDataReader.get_MetaData()+86
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,RunBehavior runBehavior,String resetOptionsString)+311
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds (CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean async)+987
System.Data.SqlClient.SqlCommand.RunExecuteReade r(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String方法,DbAsyncResult结果)+162
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String method)+32
System.Data.SqlClient.SqlCommand .ExecuteReader(CommandBehavior behavior,String method)+141
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)+12
System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)+10 System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands (EntityCommand entityCommand,CommandBehavior behavior)+443

[EntityCommandExecutionException:执行命令定义时发生错误.详情请参阅内部异常.]
System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand,行为的CommandBehavior)479
System.Data.Objects.ObjectContext.CreateFunctionObjectResult(EntityCommand entityCommand,EntitySet的EntitySet的,EdmType edmType,MergeOption mergeOption)+ 182
System.Data.Objects.ObjectContext.ExecuteFunction(字符串functionName,而MergeOption mergeOption,ObjectParameter []参数)218
System.Data.Objects.ObjectContext.ExecuteFunction(字符串functionName,而ObjectParameter []参数)53个
MetaView.DAL.MFCMData.MFCMDATAEntities .GetTradingOpenPositionCounterParty(可空1 positionDT, Nullable1个tradingAccountID)在C:\项目\ CASH \网络\ MetaView\MetaView.DAL.MFCMData\MFCMData.Designer.cs:7064个MetaView.BusinessLayer.Shared.Accounts.CounterParties.GetCounterParties(的Int32 tradingAccountID)在C: …

.net entity-framework sql-server-2008-r2

17
推荐指数
1
解决办法
1万
查看次数