Previous Next

Thread: How to get Thread Count of a Web Site which uses App Pool

Last post 08-10-2008 1:14 PM by ksingla. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 08-08-2008, 5:10 PM

    How to get Thread Count of a Web Site which uses App Pool

    Hello,

    I am trying to find out a number of Threads for an asp.net web site. The web site has been hosted in IIS 6.0 , I used the following C# code to find the number of thread.
    It works good with my location machine (Windows XP Professional) , But this same code is not working in the Development Server ( Windows Server 2003). The difference is development server has “app pool”

    Any of you know why? Or Could any of you help me find process id of a web site which is running on a app pool, so that I can get the process and get the thread count?


      using System.Diagnostics;

      public string getThreadCount()
      {
       Process wp = Process.GetCurrentProcess() ;
       return wp.Threads.Count.ToString();
      }

    Thanks
    Sundhar

  • 08-10-2008, 1:14 PM In reply to

    • ksingla
    • Top 10 Contributor
    • Joined on 06-13-2006, 11:02 PM
    • Redmond, WA
    • Posts 489

    Re: How to get Thread Count of a Web Site which uses App Pool

    Hi Sundhar,

    Thread.GetCurrentProcess() requires full trust and that is why its failing. What exactly you are trying to accomplish? Seems like you are trying to get managed thread count for an asp.net app and process threads might not be what you want for that. Read this article for more understanding on asp.net threads.

    Thanks,
    Kj

Page 1 of 1 (2 items)
Page view counter