IIS 7 and Above
Last post Mar 22, 2007 01:32 PM by thomad
Mar 15, 2007 12:56 PM|blacktop|LINK
It appears IIS 7 no longer reports data to the class Win32_PerfFormattedData_W3SVC_WebService. After doing some searching I found
Get to know the IIS7 WMI provider using CIM Studio. I downloaded and installed the WMI CIM Studio and looked around, but I don't think the WebAdministration Namespace has what I am looking for. Can anyone direct me here?
Mar 15, 2007 03:17 PM|thomad|LINK
This is probably an IIS6 WMI provider class. We have a new WMI provider in IIS7 and don't install the IIS6 WMI provider by default. You have to go to the Control Panel - Programs - "Turn Windows features on or off" and select "IIS6 WMI Compatibility" under
"Internet Information Services" - "Web Management Tools" - "IIS6 Management Compatibility".
Hope this helps.
Mar 15, 2007 03:52 PM|blacktop|LINK
OK, so can you point me in the direction of the documentation on the new provider?
Mar 15, 2007 03:58 PM|thomad|LINK
Here you go:
Mar 15, 2007 07:45 PM|blacktop|LINK
OK, great. Now, do you know of a way to access a bunch of these WMI providers efficiently? I think this is what the Win32_PerfFormattedData_W3SVC_WebService class did for IIS 6. All you need to do from there is use a ManagementObjectSearcher
to query the class and then use ManagementObject service.GetPropertyValue to get the data. (GetRequestsPersec and TotalGetRequests are two examples.)
Maybe I need to go back and read it better. But, please feel free to help out. :)
Mar 16, 2007 06:51 AM|steve schofield|LINK
When I'm trying to figure out WMI related things. I use wbemtest along with WMI Code Creator 1.0. This is a free Winforms application. I've found it handy when trying to figure out what is available using WMI
Here is an article I published access data from IIS7. It might help spark some ideas.
Windows Server MVP - IIS
Log archival solution
Install, Configure, Forget
Mar 16, 2007 01:02 PM|blacktop|LINK
Great Links, thanks!
Well, I guess the key phrase I was looking for was Performance Counter Classes. It looks like the one I want is WMIPerfClass (for Vista and Longhorn). Now, I am having trouble finding anything less than high level on it. But I will keep searching.
Mar 16, 2007 02:18 PM|blacktop|LINK
OK, now I am all confused. The original class started having counter data available (Win32_PerfFormattedData_W3SVC_WebService).
Mar 16, 2007 06:35 PM|blacktop|LINK
OK, it is the WMI Code Creator doing something to activate or initiallize the counters. The counters start having data in them after I click "Search for Property Values." I took a look at the code for the WMI Code Creator and it looked almost exactly like
mine, but I changed mine to use the same constructors for ManagementObjectSearcher with no luck.
What do you guys think? Should the counters need to be activated or initiallized? Or should I be able to access them and get valid data? In other words, should the following code provide data?
ManagementObjectSearcher(new ManagementScope("root\\CIMV2"), new WqlObjectQuery("SELECT * FROM Win32_PerfFormattedData_W3SVC_WebService"), null);
foreach (ManagementObject service in m_managObjSearch.Get())
Object tmpPropertyValue = service["ServiceUptime"];
if (tmpPropertyValue != null)
context.Response.Write("ServiceUptime: " + tmpPropertyValue);
Mar 17, 2007 01:33 AM|steve schofield|LINK
I'm glad the links helped. As far as your questions, I'd think the perf counters should have valid data you can query, assuming anything is active on the machine. I'd verify your code again a few machines to ensure the behavior is consistant. If if you
have to download and run Web Application Stress tool to load down a test box, then you can test your application in a controlled environment. That is how I rule out things like this. Hope that helps.
Mar 22, 2007 01:24 PM|blacktop|LINK
It appears it is a permissions issue. I changed the Identity of the Application Pool to LocalSystem and I was able to access the performance counters without running the command line exe. This was suggested by Microsoft Support (thanks Laura!).
Mar 22, 2007 01:32 PM|thomad|LINK
I didn't try it but instead of running your AppPool as LocalSystem you might want to make your AppPool identity member of the "Performance Monitor Users" and/or "Performance Log Users" group. You have to restart WAS after you do this (iisreset).
Here is the command-line to add NetworkService to the group:
net localgroup "Performance Monitor Users" NetworkService /add