Thoughts on Connection_Abandoned_By_AppPool

So, lately I have been getting a variety of questions about non-IIS but related issues. This is a slippery slope... but let me see how far it can go.


dear david:

I have a problem about the application pool ,it will crash after some Connection_Abandoned_By_AppPool errors. I know what happened, what I want to know is how to prevent it. coz I run a application which access another application to get data on schedule. The application access a realtime database which may not response on time, this will cause the Connection_Abandoned_By_AppPool problems. On this situation, how can I prevent these errors to make it looks working well?

Many thanx!


It is not clear to me why this is a problem about the application pool. You seem to indicate that the problem is with the application that you are running which crashes when it accesses a realtime database which may not respond on time.

So, the problems which cause Connection_Abandoned_By_AppPool, as stated by you, are:

  1. The application crashes when it cannot get the data in time
  2. The database is not really "realtime" when it should be

Now, you are interested in preventing the Connection_Abandoned_By_AppPool problems, which means you need to either:

  1. Fix the application to not crash on error conditions such as not getting the data in time
  2. Fix the database to be "realtime" so that it responds appropriately

Other than directly fixing the cause(s) of the crashes that cause Connection_Abandoned_By_AppPool, you have no alternatives to prevent errors to "make it looks working well" when things are not working well. Why?

Well, suppose someone is making a query against your web application looking for some information that is only in the database. If you do not fix the problems in your application/database, then they can fail to retrieve the information for the user's query. Now what do you do to "make it looks working well"? The user is expecting an answer, your application does not have the answer and cannot retrieve it, and you say you do not want the user to see any problems... so are you going to fake an answer?

Maybe you can introduce a highly-available data-caching layer on top of the database such that all queries do not need to go to the database all the time, but this data could be stale. Plus, you now introduce the complexity of a data-caching layer with its own bugs... without fixing the original bugs in the other application nor the database issue. Whether any of this is worth it - that is for you to decide at an architectural level. Hey, you have to think about this stuff. 🙂

In general, I advocate users to identify and fix the actual problem, not just "make it looks working well", because otherwise you tend to end up with complicated hacks that may not delay the inevitable.


Comments (21)

  1. andy says:

    :)Thank you for ur kindly reply.

    Sorry for my poor english, may be I didn’t state the problem clear enough. The application is a web page which displays realtime data trend. The realtime data is stored in a realtime database(InfoPlus21). We use javascript+XML to read the data from InfoPlus21 and display the trend on the page every 5 seconds without refreshing the page. Few missing data may not change the trend very much. But after too many errors (say: 100 Connection_Abandoned_By_AppPool or more in 12 hours ) will make IIS crashed. That’s the reason I ask for a solution "make it looks working well". If the error of missing data couldn’t be solved in a short time, at least do not crashe IIS. 🙂

    any idea?

    ps: I really want to know what behind the Connection_Abandoned_By_AppPool. What cause the error? Normaly the application runs well, so don’t know why this could happen.

    Thank you very much:)

  2. David Wang says:

    andy – Sounds like your problem is with your application crashing, not IIS.

    All Connection_Abandoned_By_AppPool says is that "the worker process running user code crashed".

    It could be IIS crashing the worker process(highly unlikely) or user code running some code that is crashing the worker process (90%+ likely).

    So, you are really asking "why is some random code crashing", and I honestly do not know.

    You may want to got through this blog entry to understand the process of troubleshooting a crash:

    Right now, it sounds like your Web page is loaded once from IIS to the browser, and then code runs on the client that directly queries the database.

    If the query does not involve IIS, then I do not see any IIS problem at all. If the query involves a request to IIS, then you need to look at your URL handling that request and debug it. This URL seems to be crashing.

    Something is crashing somewhere, and you need to identify it in the manner I describe in my referenced blog entry to have any chance of figuring out what code is crashing and causing Connection_Abandoned_By_AppPool.


  3. andy says:

    Thank you very much. I will work on this direction and try to find what happened 🙂

    best regards

  4. Jai says:

    I am getting connection abandon error in the IIS when we click on download on the file that we fetch from SRS db.

  5. David.Wang says:

    Jai – since IIS does not provide download from a DB, it sounds like you are running custom code to do the download which then results in a Connection_Abandoned_By_AppPool crash. This means you have to obtain support for that custom code that is crashing.

    You can use DebugDiag to help catch the crash, especially if you can reproduce it at will:


  6. Jaideep Mehta says:

    No there is no custom code to download the file from SRS. Basically let me explain the problem in detail.

    Files larger than 21 MB are not getting downloaded.Here i get a server reset connection error and file download is only upto certain percentage.When i check the iis log file i see Connection_Abandoned_By_AppPool error.

    Files upto 19 MB can be downloaded easily.

    These files are zipped in the Sql reporting services db.

  7. David.Wang says:

    Jaideep – IIS only knows how to do two basic things:
    1. download files that are on the FileSystem
    2. execute custom code given the request

    You said that you fetch the files from SRS DB, which suggest custom code to me. Unless you have code which copy files from the SRS DB onto the local filesystem and then create hyperlinks to those files on the filesystem for users to download *and* those URLs have no applicable application mapping to trigger custom code.

    In other words, even if you make a request to a ASP page which retrieves a file from a DB and BinaryWrite() it as content, it is still custom code performing the download.

    Now, the 20MB number reminds me of:


  8. Jaideep Mehta says:

    David – SRS is SQL reporting services, it has its own portal, so these zip files are shown as hyperlinks on the SRS portal. These zip files are stored as BLOBs in the SRS db. When the link is clicked it starts downloading the file.

    So files that are greater than 21 MB size a server reset connection error  is encountered and file download is only upto certain percentage.When i check the iis log file i see Connection_Abandoned_By_AppPool error

  9. David.Wang says:

    Jaideep – then that sounds like custom code doing download of blobs from SQL.

    If custom code is in ASP, then the KB may apply.

    If custom code is in ASP.Net, I think there is also a 20MB-download bug (I don’t have that KB handy).


  10. Jaideep Mehta says:

    David – The SRS does it all, we have not written any custom code for download. The Large files are published to SRS site, and we download these files from the SRS site.

    Please let me know your thots.

  11. David.Wang says:

    Jaideep – oh, I see where the confusion lies – custom code is not necessarily anything you have written (that would be "user code"). SRS may have written that code it already… In which case this is a support case for Microsoft.

    I am jumping ahead to thinking about what *could* cause behavior like that, and I can think of a specific KB that applies to custom code written in ASP (826756) involving a 20MB number and another for ASP.Net (don’t have its number). Do either of them fit your case?

    I think you should contact Microsoft PSS because in the case of product issues, the call and fix should be free (charge refunded back).


  12. Jaideep Mehta says:

    David – I want to tell you one observation, When Site is SSL enabled the large file is not able to down load we get a server reset error.

    When the SRS site is SSL disabled, then we are able to download the large file from the SRS site.

    Any idea on what could be happening?

  13. David.Wang says:

    Jaideep – I have no idea, but I think you should contact Microsoft Product Support. They are specifically trained to troublshoot such issues.


  14. rox.scott says:

    Connection_Abandoned_By_AppPool seems to appear when App Pool requests a recycle because virtual memory limit exceeded (i.e. PeriodicRestartMemory metabase property).  Hence, IMHO, it could result from a healthy albeit overweight application, or too many connections, etc.

  15. Heinz Martin says:

    We have the same problem with IIS6, wenn using ISAPI written  in c++. When we allocate memory with more than 550 MB in this extension, IIS6 disables our app. here the testapp as isapi


    // MEMTEST.CPP – Implementierungsdatei für Ihren Internet-Server

    //    MemTest Extension

    #include "stdafx.h"

    #include "MemTest.h"


    // Tabelle zur Befehlsinterpretation

    BEGIN_PARSE_MAP(CMemTestExtension, CHttpServer)

    // ZU ERLEDIGEN: Fügen Sie Ihr ON_PARSE_COMMAND() ein und

    // ON_PARSE_COMMAND_PARAMS() hier, um Ihre Befehle einzubinden.

    // Beispiel:

    ON_PARSE_COMMAND(SetMem, CMemTestExtension, ITS_PSTR)

    ON_PARSE_COMMAND(Default, CMemTestExtension, ITS_EMPTY)

    DEFAULT_PARSE_COMMAND(Default, CMemTestExtension)



    // Das einzige CMemTestExtension-Objekt

    CMemTestExtension theExtension;


    // CMemTestExtension Implementierung



    m_pInt = NULL ;




    if (m_pInt)

    delete m_pInt ;

    m_pInt = NULL ;


    BOOL CMemTestExtension::GetExtensionVersion(HSE_VERSION_INFO* pVer)


    // Aufruf der Standardimplementierung für die Initialisierung


    // Einlesen der Beschreibungszeichenfolge




    _tcscpy(pVer->lpszExtensionDesc, sz);

    return TRUE;


    BOOL CMemTestExtension::TerminateExtension(DWORD dwFlags)


    // Erweiterung wird beendet

    //ZU ERLEDIGEN: Alle Per-Instanz-Ressourcen bereinigen

    return TRUE;



    // CMemTestExtension Befehls-Handler

    void CMemTestExtension::Default(CHttpServerContext* pCtxt)




    *pCtxt << _T("This default message was produced by the Internet");

    *pCtxt << _T(" Server DLL Wizard. Edit your CMemTestExtension::Default()");

    *pCtxt << _T(" implementation to change it.rn");



    // Die folgenden Zeilen nicht bearbeiten. Sie werden vom Klassenassistenten benötigt.

    #if 0

    BEGIN_MESSAGE_MAP(CMemTestExtension, CHttpServer)




    #endif // 0


    // Verwendet Ihre Erweiterung nicht die MFC, benötigen Sie diesen Code, um sicherzustellen,

    // dass die Erweiterungsobjekte das Ressourcen-Handle für das Modul finden können.

    // Wollen Sie Ihre Erweiterung so umwandeln, dass sie nicht von MFC abhängt,

    // entfernen Sie die Kommentare um die nachfolgenden AfxGetResourceHandle()

    // und DllMain()-Funktionen sowie die globale Varaible g_hInstance.


    static HINSTANCE g_hInstance;

    HINSTANCE AFXISAPI AfxGetResourceHandle()


    return g_hInstance;


    BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ulReason,

    LPVOID lpReserved)


    if (ulReason == DLL_PROCESS_ATTACH)


    g_hInstance = hInst;


    return TRUE;



    void CMemTestExtension::SetMem(CHttpServerContext *pCtxt, LPCSTR MemSizeMB)


    *pCtxt << "<html><head><titel>Test Memory</title></head>rn<body>" ;

    char *cp = strstr(MemSizeMB,"=") ;

    if (!cp)


    *pCtxt << "Fehler</BODY></HTML>" ;

    return ;


    cp++ ;

    int theSize = atoi(cp) ;

    theSize *= 1024 ; // KB

    theSize *= 1024 ; // MB

    if (m_pInt)

    delete m_pInt ;

    m_pInt = new char[theSize] ;

    CString Str ;

    if (m_pInt)

    Str.Format ("Speicher von %i MB erstelle</BODY></HTML>",theSize / (1024*1024)) ;


    Str.Format ("Speicher von %i MB <B>NICHT</B>erstelle</BODY></HTML>",theSize / (1024*1024)) ;

    *pCtxt << Str ;



    #if !defined(AFX_MEMTEST_H__5D3BF5AB_497D_4DD0_816C_9EA532DCF4F1__INCLUDED_)

    #define AFX_MEMTEST_H__5D3BF5AB_497D_4DD0_816C_9EA532DCF4F1__INCLUDED_

    // MEMTEST.H – Header-Datei für Ihren Internet-Server

    //    MemTest Extension

    #include "resource.h"

    class CMemTestExtension : public CHttpServer



    char *m_pInt;

    void SetMem(CHttpServerContext* pCtxt,LPCSTR MemSizeMB);



    // Überladungen

    // Vom Klassenassistenten generierte Überladungen virtueller Funktionen

    // HINWEIS – An dieser Stelle werden Member-Funktionen vom Klassen-Assistenten eingefügt und entfernt.

    //    Innerhalb dieser generierten Quelltextabschnitte NICHTS VERÄNDERN!



    virtual BOOL GetExtensionVersion(HSE_VERSION_INFO* pVer);


    virtual BOOL TerminateExtension(DWORD dwFlags);

    // ZU ERLEDIGEN: Hier Handler für Ihre Befehle einfügen.

    // Beispiel:

    void Default(CHttpServerContext* pCtxt);






    // Microsoft Visual C++ fügt unmittelbar vor der vorhergehenden Zeile zusätzliche Deklarationen ein.

    #endif // !defined(AFX_MEMTEST_H__5D3BF5AB_497D_4DD0_816C_9EA532DCF4F1__INCLUDED)

    any comments?

  16. rajendraps says:

    Hi David,

    I have a Web Application in which I need to pass a URL with querystring which works fine when passed to Response.Redirect(). But when passed to Server.Transfer() it hangs and it updates

    "Connection_Abandoned_By_AppPool DefaultAppPool" as error in the following location.


    I have to use Server.Transfer() instead of Response.Redirect() as per customer scenario.

    Do you have a solution for the same?

  17. rajendraps says:

    Hi David,

    I have a Web Application in which I need to pass a URL with querystring which works fine when passed to Response.Redirect(). But when passed to Server.Transfer() it hangs and it updates

    "Connection_Abandoned_By_AppPool DefaultAppPool" as error in the following location.


    I have to use Server.Transfer() instead of Response.Redirect() as per customer scenario.

    Do you have a solution for the same?

  18. Paulraj says:


    I solved a similar problem by looking at the following article:


  19. james says:

    The above support link worked for me too lol.

  20. Benjamin Abbott-Scott says:

    Connection_Abandoned_By_AppPool can also come about when a worker process is recycled.  I’m currently doing some testing with time-based vs. request-based recycling.  We have a number of sites that are returning 503 errors or 500 errors when the worker process recycles at its 60 minute deadline.  It appears that the time based recycle causes any standing requests to be dropped in a bad way.  I’m hoping that switching over to recycle after N requests will ensure that the thread finishes those N requests and does not get passed more until it recycles.

    Does anyone know if IIS will stop passing new requests to a worker thread when it’s ready to recycle?

  21. David.Wang says:

    Benjamin – if you see 500 or 503, then you are seeing Connection_Abandoned_By_AppPool due to bugs in your application or your Application Pool configuration.

    When IIS decides to recycle a worker process due to a metric like time or #-requests, it will atomically switch future requests to the new worker process in an overlapping fashion by default. You can configure to be non-overlapping.

    i.e. For any recycling metric, suppose the Nth request is handled by the original worker process and the N+1st request is handled by the new worker process. Overlapped recycle means that the N+1st request does not wait for the Nth request to finish in the original worker process before starting itself in the new worker process.

    Overlapped recycling is usually ok, unless the application assumes that it is a singleton and has a lock on something system-wide like a log file or mutex. This system-wide lock becomes a problem when the N+1st request starts up in the new worker process (and tries to lock the resource) when the Nth request is still running in the old worker process (and has the lock on the resource). This frequently causes the N+1st request to fail, and if enough of it fails in a short enough time, the AppPool falls into 503.

    In all cases, if you see errors during worker process recycling, it is either a bug in the application, or there is a misconfiguration in the user’s configuration of the Application Pool settings which conflict with the application’s behavior.


Skip to main content