Sometimes WMI classes may not appear automatically as they should. If you execute 'wmiadap /f' in the command prompt it will reparse all performance libraries on the system (you'll be able to see new libraries after system restart).
In a meanwhile performance counter you are looking for is one of the standard you may want to take a look at Performance Counter Classes list.
You may be able to do this with built-in Event Log monitoring.
If the application pool is shutting down due to the rapid fail protection, there is probably an event id 5002 like the following in the System event log:
"Application pool 'AppPoolName' is being automatically disabled due to a series of failures in the process(es) serving that application pool."
Create a scheduled task for a custom event log trigger. A manual XML query would look something like this:
<QueryList>
<Query Id="0" Path="System">
<Select Path="System">*[System[Provider[@Name='Microsoft-Windows-WAS'] and (EventID=5002)]]
and *[EventData[Data[@Name='AppPoolID'] and (Data='YourAppPoolFriendlyName')]]</Select>
</Query>
</QueryList>
Your scheduled task action could be to run a script that runs appcmd to restart the specific application pool.
appcmd recycle apppool /?
Recycle application pool
APPCMD recycle APPPOOL <identifier> <-parameter1:value1 ...>
Recycles the specified application pool, recycling its the worker processes.
The exact application pool identifier must be provided and must resolve to an
existing application pool.
Supported parameters:
identifier (required)
Application pool name of the application pool to recycle
/apppool.name
Application pool name of the application pool to recycle (same as
identifier)
Examples:
appcmd recycle apppool "MyAppPool"
Recycle the application pool "MyAppPool".
If you have multiple application pools on the same server, you may need to refine the XML filter to specify the application pool id. Here is a sample event XML text:
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name="Microsoft-Windows-WAS" Guid="{524B5D04-133C-4A62-8362-64E8EDB9CE40}" EventSourceName="WAS" />
<EventID Qualifiers="49152">5002</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2012-10-01T19:41:43.000000000Z" />
<EventRecordID>408764</EventRecordID>
<Correlation />
<Execution ProcessID="0" ThreadID="0" />
<Channel>System</Channel>
<Computer>WEBSERVERNAME.company.com</Computer>
<Security />
</System>
- <EventData>
<Data Name="AppPoolID">YourAppPoolFriendlyName</Data>
<Binary />
</EventData>
</Event>
Info on Event Log Advanced Filtering:
https://blogs.technet.com/b/askds/archive/2011/09/26/advanced-xml-filtering-in-the-windows-event-viewer.aspx
Use APPCMD to recycle an application pool:
http://technet.microsoft.com/en-us/library/cc770764%28v=ws.10%29.aspx
Best Answer
Found it.
There is a .Delete() method that does the trick.
Done.