Sometimes we had to face a problem thread being aborted while long running web service which is call from a website through soap request.
Why this error is raising while doing a long running process in ASP.Net 2.0 , Answer from the Microsoft is IIS is not designed for a long running process.
What makes the running thread to be Aborted in ASP.Net ?
- while any error is raised in your application, if there is no catch block, because of UnHandledException Thread is begin Aborted abruptly.
- RoundRobin Request Makes AppDomain to ReCycle.
- After a IdleTime Out ApplicationPool Automatically Recycles (If there is no more request is received for asp.net page from client more than IdleTimeOut minutes)
u IIS may have recycled the application pool for whatever reason.
u IIS may have restarted
u Some settings on the server that limits asp.net execution time.
To Avoid the thread Being Aborted , if it process by Application pool, Increase the Execution Time Out of Web Service
l Change the web.config file and setting in IIS.
l Increase the executionTimeOut and application pool ideal time out.
Timeout in Debug mode
Default script timeout on IIS is only 90 seconds. When you start web application in debug mode it is 300 000 seconds (almost a year). So, timeout errors are visible only when running release code.
Change server timeout in Web.config
If you want to have an option to change server timeout value later, after code is compiled, one of easy ways is to change it as parameter through a web.config. You can set server timeout with code like this: Default executionTimeout is 90 seconds.
<configuration> <system.web> <httpRuntime maxRequestLength="4000" executionTimeout="45" /> </system.web> </configuration>
Change Application Pool Ideal Timeout
- Open IIS Manager.type inetmgr in run
- In the Connections pane, expand the server node and click Application Pools.
- On the Application Pools page, select the application pool for which you want to specify idle time-out settings, and then click Advanced Settings in the Actionspane.
- In the Idle Time-out (minutes) box, type a number of minutes, and then click OK.
Problem with application restart when running long tasks in ASP.NET
when work with long running tasks. Application could restart because of different outside reasons, and then your long operation is stopped too. The reason can be
- Change in global.asax file
- Change in web.config file
- Change in machine.config file
- Change in content of bin folder
- Add a new folder inside App folder
- Even some antivirus also reason
Health Monitoring
How we can find out which makes the Thread being Aborted for ASP.Net ?
Health Monitoring : Health Monitoring is the One of the Framework that is forgotten by Asp.Net Developers. It Provides great Monitoring features in Diagnose Failing Application and systems. Asp.Net Errors are placed in system event logs.
To Enable that Change in Master Web.Config file which is placed in Dotnet framework installation directory %WINDIR%\Microsoft.NET\Framework\version\CONFIG . From the Config file we removed some
markup to show clearly.
<configuration> <system.web> <healthMonitoring>
<eventMappings> <add name="All Errors" type="System.Web.Management.WebBaseErrorEvent,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" endEventCode="2147483647"/> <add name="Failure Audits" type="System.Web.Management.WebFailureAuditEvent,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" endEventCode="2147483647"/> </eventMappings> <providers> <add name="EventLogProvider" type="System.Web.Management.EventLogWebEventProvider,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"/> <add connectionStringName="LocalSqlServer" maxEventDetailsLength="1073741823" buffer="false" bufferMode="Notification" name="SqlWebEventProvider" type="System.Web.Management.SqlWebEventProvider,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"/> </providers> <rules> <add name="All Errors Default" eventName="All Errors" provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" custom=""/> <add name="Failure Audits Default" eventName="Failure Audits" provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" custom=""/> </rules> </healthMonitoring> </system.web> </configuration>
Health Monitoring :
1. Monitor the health and performance of the application.
2. Diagnose the application or system failures.
3. appraise significant events during the life cycle of an application.
4. Monitor live ASP.NET applications, individually or across a Web farm.
5. Log events that do not necessarily relate to errors in an ASP.NET application.
the <eventMappings> element assigns the human-friendly name "All Errors" to the health monitoring events of type WebBaseErrorEvent and the name "Failure Audits" to health monitoring events of type WebFailureAuditEvent
The <providers> element defines the log sources,The first <add> element defines the "EventLogProvider" provider, which logs the specified health monitoring events using the EventLogWebEventProvider class. The EventLogWebEventProvider class logs the event to the Windows Event Log. The second <add> element defines the "SqlWebEventProvider" provider, which logs events to a Microsoft SQL Server database via the SqlWebEventProvider class. The "SqlWebEventProvider" configuration specifies the database's connection string (connectionStringName) among other configuration options.
The <rules> element maps the events specified in the <eventMappings> element to log sources in the<providers> element. By default, ASP.NET web applications log all unhandled exceptions and audit failures to the Windows Event Log.
Now change the Web.Config file in your Asp.Net Application
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
</compilation>
<healthMonitoring enabled="true" heartbeatInterval="120">
<rules>
<add name="Heartbeats Default" eventName="Heartbeats" provider="EventLogProvider"
profile="Default" />
<add name="Application Lifetime Events Default"
eventName="Application Lifetime Events"
provider="EventLogProvider"
profile="Default" />
<add name="Request Processing Events Default"
eventName="Request Processing Events"
provider="EventLogProvider"
profile="Default" />
</rules>
</healthMonitoring>
</system.web>
</configuration>
After deploy the application , when we launch the application we can see the event log with codes 1001 , 1002 gives information about application start up and shut down. code 1005 traced every 120 seconds (hearbeatinterval = 120).
From this log we can say whether our application is consuming to much memory or queuedin user request.
From This article we can find the various possibilities of Thread Aborting for a long running task,
And Process of Health Monitoring
This blog fixed my issue. Thanks
ReplyDeleteWlc
DeleteWhich step resolved the issue in your case?
DeleteYou can try to increase the httpRuntime Execution Timeout, as well as IdleTimeout in App pool and increase timeout in web.config, may resolve issue in timeout
DeleteHello I am so delighted I found your blog, I really found you by mistake, while I was looking on Yahoo for something else, anyways I am here now and would just like to say thanks for a tremendous post. Please do keep up the great work.
ReplyDeletepython Training in Pune
python Training in Chennai
python Training in Bangalore
This comment has been removed by the author.
ReplyDeleteFor Devops training in Bangalore <== VISIT
ReplyDeleteI have a very useful post to share about this since its actually very necessary to look up for solutions to such problems.
ReplyDeleteSQL Server Load Soap API
The content of this website was really informative. 50 High Quality Backlinks for just 50 INR
ReplyDelete2000 Backlink at cheapest
5000 Backlink at cheapest
Boost DA upto 15+ at cheapest
Boost DA upto 25+ at cheapest
Boost DA upto 35+ at cheapest
Boost DA upto 45+ at cheapest
Thanks for information dot net online training
ReplyDeleteVirtual events are naturally more inclusive than in-person events in many respects but there are still a lot of things that planners can do to make them more accessible to people with disabilities. event marketing and thank you email after networking event
ReplyDeleteWe are used to the fact that we know only religious and public holidays and celebrate only them.Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder
ReplyDeleteAnnabelle loves to write and has been doing so for many years.iamlinkfeeder1 iamlinkfeeder1 iamlinkfeeder1
ReplyDeleteAnnabelle loves to write and has been doing so for many years.Backlink Indexer My GPL Store Teckum-All about Knowledge
ReplyDeleteThis comment has been removed by the author.
ReplyDeletesakarya
ReplyDeleteyalova
elazığ
van
kilis
WDJ
görüntülüshow
ReplyDeleteücretli show
YVAT
https://titandijital.com.tr/
ReplyDeletebingöl parça eşya taşıma
kırşehir parça eşya taşıma
gümüşhane parça eşya taşıma
rize parça eşya taşıma
PPDSKU
EDA2C
ReplyDeleteAğrı Parça Eşya Taşıma
Çorum Parça Eşya Taşıma
Urfa Evden Eve Nakliyat
Antep Lojistik
Hatay Evden Eve Nakliyat
E8997
ReplyDeleteÜnye Çatı Ustası
Ardahan Evden Eve Nakliyat
Uşak Şehirler Arası Nakliyat
Çerkezköy Ekspertiz
TekirdaÄŸ Cam Balkon
Çerkezköy Çatı Ustası
Kucoin Güvenilir mi
Bitlis Lojistik
Karabük Parça Eşya Taşıma
AD86F
ReplyDeleteDiyarbakır Evden Eve Nakliyat
Sakarya Parça Eşya Taşıma
Kastamonu Parça Eşya Taşıma
Malatya Şehir İçi Nakliyat
Silivri Çatı Ustası
Karaman Evden Eve Nakliyat
Yalova Lojistik
Yobit Güvenilir mi
Adana Şehirler Arası Nakliyat
C9A1A
ReplyDeleteKonya Evden Eve Nakliyat
Loop Network Coin Hangi Borsada
Karaman Şehirler Arası Nakliyat
Gölbaşı Parke Ustası
Van Şehirler Arası Nakliyat
Eryaman Parke Ustası
Ordu Şehir İçi Nakliyat
Ä°stanbul Evden Eve Nakliyat
Çankırı Parça Eşya Taşıma
0B888
ReplyDeletereferans kodu %20
14D70
ReplyDeletebinance kod
9DAA6
ReplyDeleteadana canlı sohbet odası
Tekirdağ Canlı Sohbet
sohbet siteleri
izmir en iyi görüntülü sohbet uygulamaları
çanakkale sesli sohbet odası
en iyi sesli sohbet uygulamaları
NiÄŸde Canli Sohbet Chat
Çanakkale En İyi Görüntülü Sohbet Uygulamaları
bilecik kadınlarla ücretsiz sohbet
019B2
ReplyDeleteSohbet
Mexc Borsası Güvenilir mi
Yeni Çıkan Coin Nasıl Alınır
Mexc Borsası Kimin
Bitcoin Nasıl Kazanılır
Kwai Beğeni Satın Al
Coin Çıkarma Siteleri
Likee App Beğeni Satın Al
Binance'de Kaldıraç Var mı