Performance Counter - System.InvalidOperationException: Category does not exist

前端 未结 5 1438
花落未央
花落未央 2020-12-08 17:19

I have following class that returns number of current Request per Second of IIS. I call RefreshCounters every minute in order to keep Requests per Second value refreshed (be

5条回答
  •  醉梦人生
    2020-12-08 17:27

    I just solved this type of error or exception with:

    Using,

    new PerformanceCounter("Processor Information", "% Processor Time", "_Total");
    

    Instead of,

    new PerformanceCounter("Processor", "% Processor Time", "_Total");
    

提交回复
热议问题