3

I am getting a weird error while running my WCF service. Thread abort receiving while running i searched for many solution nothing helped am posting my error below.

I am calling a WCF service from the webpage. The WCF service executes a stored procedure in a for loop, whether this causes thread abort? I even tried increasing the httpruntime execution timeout in web.config but without success.

System.Threading.ThreadAbortException: Thread was being aborted.
   at SNIReadSyncOverAsync(SNI_ConnWrapper* , SNI_Packet** , Int32 )
   at SNINativeMethodWrapper.SNIReadSyncOverAsync(SafeHandle pConn, IntPtr& packet, Int32 timeout)
   at System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync()
   at System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket()
   at System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer()
   at System.Data.SqlClient.TdsParserStateObject.TryReadByte(Byte& value)
   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)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
   at System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
   at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
   at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Your call to DB is being time out. Check that your SP takes how much time in Managment console ? – Mairaj Ahmad May 21 '15 at 06:02
  • Seems to be a timeout issue. Check [this post](http://stackoverflow.com/questions/1520283/wcf-service-how-to-increase-the-timeout) to see if changing the WCF service timeouts can help. – ChrisC73 May 21 '15 at 06:06
  • When i run the same code with the same db from server am not facing any issues, but when i running the same in server am getting the issues @MairajAhmad.. – Boominathan May 21 '15 at 06:12
  • closeTimeout="10:01:00" openTimeout="10:01:00" receiveTimeout="10:10:00" sendTimeout="10:01:00" my binding config... @ChrisC73 – Boominathan May 21 '15 at 06:17
  • I think we need some more information here: 1) How long does the service take before throwing the exception? 2) what does the WCF client and service config look like? – ChrisC73 May 21 '15 at 06:24
  • 1
    Another possibility is something [writing to your website's bin directory](http://siderite.blogspot.com/2007/10/solution-to-thread-was-being-aborted.html), causing it to restart the app pool. – ChrisC73 May 21 '15 at 06:35
  • 1.the service takes 1 min before throwing error. 2.Both bindings and configuration are same for both client and service. – Boominathan May 21 '15 at 07:00
  • You need to share the code that causes this exception and it would also be helpful if you could indicate what the connection timeout settings are on your Sql Connection. – rene May 23 '15 at 10:48
  • You made my day @ChrisC73, in my case I was writing a config file in the bin directly of an ASP.NET app, and it was systematically causing ThreadAbortException! – Erwin Mayer Jul 14 '18 at 14:17

0 Answers0