Asked by:
Problem in fetching performance counter data of "ASP.NET" and "ASP.NET Applications".

General discussion
-
Hi All,
I am trying to fetch data from performance counter of "ASP.NET" and "ASP.NET Applications". This is a C++ based application. I have put sample code part of this application. This application is based on a sample provided on microsoft site.
IWbemLocator *pLoc;
IWbemServices *pSvc;
IEnumWbemClassObject *pEnumeratorASPNET;
//Step 1 - Initailize COM
//Step 2 - Set security related parameter for COM authentication
//Step 3 - Create Instance of IWebmLocator
//Step 4 - Connect to WMI Namespace
//Step 5 - Connect to Proxy
//Step 6 - Run required queries
hr = pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t("SELECT * FROM ASP.NET"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumeratorASPNET);if (FAILED(hr))
{
pSvc->Release();
pLoc->Release();
CoUninitialize();
return;
}My problem is i am not getting data for the above two generic perfromance counters if i try to access it through code. But it shows data in perfmon. If try to access version specfic performance counter i can access it.
If any quick help would be appreciated
Thanks in advance,
Gangaprasad
Friday, November 2, 2007 11:30 AM
All replies
-
Is your code running in full trust?Friday, November 2, 2007 5:27 PM
-
-
Hi gp_dotnet_guy,
We are changing the issue type to “Comment” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by editing your initial post and changing the radio button at the top of the post editor window. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.
Thank you!
Monday, November 5, 2007 2:55 AM -
Hi Inbar Gazit
Sorry for late reply because i was out for office for couple of days. Anyways to answer your question i am putting here code details of step 1 to step 5 which were not there in my previous post.
HRESULT hr;
IWbemLocator *pLoc;
IWbemServices *pSvc;
//Step 1 - Initailize COM
hr = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hr)){
return;}
hr = CoInitializeSecurity(
NULL,
-1,
// COM authenticationNULL,
// Authentication servicesNULL,
// ReservedRPC_C_AUTHN_LEVEL_DEFAULT,
// Default authenticationRPC_C_IMP_LEVEL_IMPERSONATE,
// Default ImpersonationNULL,
// Authentication infoEOAC_NONE,
// Additional capabilitiesNULL
// Reserved);
{
CoUninitialize();
return;}
hr = CoCreateInstance(CLSID_WbemLocator,0,CLSCTX_INPROC_SERVER,IID_IWbemLocator, (LPVOID *) &pLoc);
if (FAILED(hr)){
CoUninitialize();
return;}
hr = pLoc->ConnectServer(
_bstr_t(L"ROOT\\CIMV2"),
// Object path of WMI namespaceNULL,
// User name. NULL = current userNULL,
// User password. NULL = current0,
// Locale. NULL indicates currentWBEM_FLAG_CONNECT_USE_MAX_WAIT,
// Security flags.0,
// Authority (e.g. Kerberos)0,
// Context object&pSvc
// pointer to IWbemServices proxy);
{
pLoc->Release();
CoUninitialize();
return;}
hr = CoSetProxyBlanket(
pSvc,
// Indicates the proxy to setRPC_C_AUTHN_WINNT,
// RPC_C_AUTHN_xxxRPC_C_AUTHZ_NONE,
// RPC_C_AUTHZ_xxxNULL,
// Server principal nameRPC_C_AUTHN_LEVEL_CALL,
// RPC_C_AUTHN_LEVEL_xxxRPC_C_IMP_LEVEL_IMPERSONATE,
// RPC_C_IMP_LEVEL_xxxNULL,
// client identityEOAC_NONE
// proxy capabilities);
{
pSvc->Release();
pLoc->Release();
CoUninitialize();
return;}
//Step 6 - Rest of code goes here
Monday, November 12, 2007 10:13 AM