on prod应用程序在从我的db上下文中检索数据时抛出一个ThreadAbortException,它大约是100万行数据表。 我设置有意设置一个5小时的大CommandTimeOut,但即使我有一个system.web.httpException达到超时。通过记录,我可以获得此跟踪:
07/11/2013 09:54 :
System.Threading.ThreadAbortException: Le thread a été abandonné.
à SNIReadSync(SNI_Conn* , SNI_Packet** , Int32 )
à SNINativeMethodWrapper.SNIReadSync(SafeHandle pConn, IntPtr& packet, Int32 timeout)
à System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)
à System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket()
à System.Data.SqlClient.TdsParserStateObject.ReadBuffer()
à System.Data.SqlClient.TdsParserStateObject.ReadByte()
à System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
à System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
à System.Data.SqlClient.SqlDataReader.get_MetaData()
à System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
à System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
à System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
à System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
à System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
à System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
à System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
à System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
à System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
à System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
à System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
à LinqKit.ExpandableQuery`1.GetEnumerator()
à System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
à System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
à DrillWatcher.DisplaySegment.GetSegmentDataTable(ICollection`1 idDrills, List`1 segmentColumnToDisplay) dans C:\SourcesTFS\JLSA\Main\Source\DrillWatcher\DrillWatcher\DrillWatcher\DisplaySegment.aspx.cs:ligne 262
à DrillWatcher.DrillWatcher.MakeCsvFile(DataTable source, Boolean withSegment) dans C:\SourcesTFS\JLSA\Main\Source\DrillWatcher\DrillWatcher\DrillWatcher\DrillWatcher.aspx.cs:ligne 989
代码:
public static DataTable GetSegmentDataTable(ICollection<long> idDrills, List<string> segmentColumnToDisplay)
{
var predicat = PredicateBuilder.True<DrillSegments>();
Expression<Func<DrillSegments, bool>> exp = segments => idDrills.Contains(segments.DrillId);
predicat = predicat.And(exp);
using (var dqe = new DrillQuerierEntities { CommandTimeout = 18000})
{
try
{
//Nom du forage
var result = dqe.DrillSegments.Include("DrillSegmentInfo.DrillSegmentInfoExtraData").AsExpandable().Where(predicat).OrderBy(x => x.SequenceNumber).ToList(); // first toList so querying db
var segmentDataTable = new DataTable("DrillSegments");
-------------
对这个奇怪的异常有什么看法吗? Thx for advance
答案 0 :(得分:1)
这是ASP.NET请求/页面超时。当达到超时时,ASP.NET将中止该线程。当工作进程关闭时,也可能由于新的代码部署而发生这种情况。增加请求超时。我认为该属性名为ScriptTimeout
。