We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Application Pool memory leak?RSS

6 replies

Last post Apr 12, 2018 08:36 AM by zaqxen___

  • Application Pool memory leak?

    Sep 04, 2014 09:21 AM|martiendejong2008|LINK


    One of the ASP.NET websites that I am hosting in an IIS6 environment on a Windows 2003 server has this problem where every now and then the application pool has to be restarted because the site starts to show unexpected behavior. 

    The following things happen:

    • content is served only partially, with the missing parts replaced by gibberish.
    • ASPX pages start throwing errors.
    • There are errors in the SQL syntax of the queries that are run on the page.
    • Stylesheets and other assets are suddenly not available anymore.

    These problems appear on the same pages consistently. When I look into the code there is nothing irregular there.

    When the application pool is restarted the application behaves normally again.

    I had these results only on the production environment and never on the development or staging.

    I was unable to find anything useful on the net, but I suspect that something in the application is causing it to become corrupted in this way.

    The application does the following:

    • run SQL queries.
    • display DevExpress forms.
    • generate PDF and Excel documents.

    If someone has an idea what may be causing this I would be really grateful because I am completely stuck on this for months and so are my colleagues.

    Thanks a lot for any replies!

  • Re: Application Pool memory leak?

    Sep 05, 2014 02:04 AM|Pengzhen Song - MSFT|LINK

    Hi martiendejon,

    I suggest that you can troubleshoot IIS Performance Issues or Application Errors using LogParser. This troubleshooter will help you analyze IIS log files in an effort to determine the cause when an application that is hosted on IIS is failing or experiencing performance issues.

    For more information, you can refer here


    #Fix the 3 silent performance killers for IIS / ASP.NET apps


    We are trying to better understand customer views on social support experience. Click HERE to participate the survey.
  • Re: Application Pool memory leak?

    Sep 05, 2014 03:03 AM|martiendejong2008|LINK

    Hi Pengzhen,

    Thank you for taking the time to investigate my issue. I used the Log Parser and I see the following results:

    Most pages are HTTP 200, and even when the page's contents are completely messed up there is no error it gets served normally.

    An occasional page gives HTTP 404, these files or pages do exists but it appears that the webserver at that time is unable to serve it.

    An occasional HTTP 500, when there is an SQL Exception in the page.

    And when the application pool is recycled everything works fine again.

    Just to be clear there is NO dynamic SQL in the pages with give an SQL exception, just static queries with some parameters.

    The pages that give a 404 error are also 'normal' pages, some are even static content, like stylesheets or images. They just aren't served anymore when the application goes to error mode.

    I still don't have a clue.

  • Re: Application Pool memory leak?

    Sep 09, 2014 03:06 AM|martiendejong2008|LINK

    Is there anyone who can help me with this?

    Did I not supply enough information? If I need to supply more info please tell me what I should provide.


    • Application pool goes bad and breaks the application until recycled.
    • Until the apppool is recycled, I get 404's, SQL syntax errors and the content that is served is broken.

    Anyone please...?

  • Re: Application Pool memory leak?

    Sep 10, 2014 02:49 AM|martiendejong2008|LINK

    The event log says this: (sorry it's in dutch)

    Gebeurteniscode: 3005 Gebeurtenisbericht: Er is een onverwerkte uitzondering opgetreden. ... ... Procesinformatie: Proces-id: 7484 Procesnaam: w3wp.exe  Uitzonderingsinformatie: Uitzonderingstype: ArgumentException Uitzonderingsbericht: De kolom description hoort niet bij de tabel . bij System.Data.DataRow.GetDataColumn(String columnName) bij System.Data.DataRow.get_Item(String columnName) bij ... removed the rest for privacy reasons) ...

    Basically what it says is that the column does not belong to the table that is returned by an SQL query. This happens for various queries that have nothing strange in them (just queries like SELECT id, name, description FROM roles WHERE userid=@id) 

    I did find a solution by catching the exception and then resetting the application pool in the website itself by using this code:

    Public Sub ResetAppPool(appPool As String)
    Dim entry
    entry = New DirectoryEntry("IIS://localhost/W3SVC/AppPools/" + appPool)
    entry.Invoke("Recycle", Nothing)
    End Sub

    Of course this is a workaround and I am still curious what is happening here and what can be done about it.

  • Re: Application Pool memory leak?

    Oct 13, 2014 06:02 AM|martiendejong2008|LINK

    Another bump... I am still looking for the answer to this problem. The application pool is resetting multiple times a day now and it really is a problem for our customers. I still do not have a clue on how to solve this. If anyone could point me in a direction that would be great!

  • Re: Application Pool memory leak?

    Apr 12, 2018 08:36 AM|zaqxen___|LINK

    Things to look at:

    • Long Running SQL Queries
    • Try to avoid File Create, Edit & Update on Web Pages even as simple as Logging to text file
    • Make sure all task is done on the Web in milliseconds, as the users throughput rises your Application Pool Memory is affected
    • If long task is unavoidable, create a local App that do the task instead and pushes the output once done.
    • Make sure that the Web App is not running on Debug Mode

    Hope this help or somehow minimizes its occurrence.