Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - performancecounter object and remote server

Reply
 
Old 05-27-2008   #1 (permalink)
SalamElias


 
 

performancecounter object and remote server

Has anybody worked with performancecounter object to access counters on
remote machine?
I managed to write code that retrieves counters categories froma remote
machine, when I try another remote machine I get
"System.ComponentModel.Win32Exception" error. Error message is
"The network path was not found."
I have checked running services (RPC, Remote registery.....) on both
machines and they are exactly the same.
I am wondering if there is anything to configure to allow access to counters
remotly that I am missing on the 2nd machine.
The scenarion is as follows :
I have a workgroup,not a domain, 1 XP laptop (where I have VS 2005), 2
virtual win2k3 machines. when runing the code, the mentioned error happens at
the following line

Dim AllCountersCategories As PerformanceCounterCategory() =
PerformanceCounterCategory.GetCategories(strServerName)

Regarding network connection, I can map a connection to both servers in
windows explorer. the user and password I use to log tomy XP machine are also
created on both machines.

The error message really doesn't give any clue why I am not able to retrieve
the 2nd machines counters whereas it it works like a charm with the other
server.
Thanksd in advance


My System SpecsSystem Spec
Old 05-28-2008   #2 (permalink)
Steven Cheng [MSFT]


 
 

RE: performancecounter object and remote server

Hi Salam,

From your description, you're using the .NET performance counter to open
counters on remote machine, however, you got the following error, correct?
Quote:

>"System.ComponentModel.Win32Exception" error. Error message is
>"The network path was not found."
based on my research, so far for remote performance counter accessing, the
following blog entry has mentioned some information:

#How to Read Performance Counters Without Administrator Privileges [Ryan
Byington]
http://blogs.msdn.com/bclteam/archiv...08/746900.aspx

Also, as you mentioned the non-domain environment, I think it is also
related to the problem. I've performenced tests on my side, in a domain
environment, I can get the code you provided run correctly(event if I try
running under a local account, has same username/password on both machine).
Are you running through an account has same username/password on both
machine and is it an administrator account?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxx.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Quote:

>From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <eliassal@xxxxxx>
>Subject: performancecounter object and remote server
>Date: Tue, 27 May 2008 01:24:00 -0700
Quote:

>
>Has anybody worked with performancecounter object to access counters on
>remote machine?
>I managed to write code that retrieves counters categories froma remote
>machine, when I try another remote machine I get
>"System.ComponentModel.Win32Exception" error. Error message is
>"The network path was not found."
>I have checked running services (RPC, Remote registery.....) on both
>machines and they are exactly the same.
>I am wondering if there is anything to configure to allow access to
counters
Quote:

>remotly that I am missing on the 2nd machine.
>The scenarion is as follows :
>I have a workgroup,not a domain, 1 XP laptop (where I have VS 2005), 2
>virtual win2k3 machines. when runing the code, the mentioned error happens
at
Quote:

>the following line
>
>Dim AllCountersCategories As PerformanceCounterCategory() =
>PerformanceCounterCategory.GetCategories(strServerName)
>
>Regarding network connection, I can map a connection to both servers in
>windows explorer. the user and password I use to log tomy XP machine are
also
Quote:

>created on both machines.
>
>The error message really doesn't give any clue why I am not able to
retrieve
Quote:

>the 2nd machines counters whereas it it works like a charm with the other
>server.
>Thanksd in advance
>
>
My System SpecsSystem Spec
Old 05-28-2008   #3 (permalink)
SalamElias


 
 

RE: performancecounter object and remote server

Thanks Steven, I read the blog which has interesting information but it
doesn't apply to my context.
Yes, I am running through an account has same username/password on 3 mac
hines and which are all declared in administrators group.
So, I think I should not need to apply instructions mentioned in the blog

"Steven Cheng [MSFT]" wrote:
Quote:

> Hi Salam,
>
> From your description, you're using the .NET performance counter to open
> counters on remote machine, however, you got the following error, correct?
>
Quote:

> >"System.ComponentModel.Win32Exception" error. Error message is
> >"The network path was not found."
>
> based on my research, so far for remote performance counter accessing, the
> following blog entry has mentioned some information:
>
> #How to Read Performance Counters Without Administrator Privileges [Ryan
> Byington]
> http://blogs.msdn.com/bclteam/archiv...08/746900.aspx
>
> Also, as you mentioned the non-domain environment, I think it is also
> related to the problem. I've performenced tests on my side, in a domain
> environment, I can get the code you provided run correctly(event if I try
> running under a local account, has same username/password on both machine).
> Are you running through an account has same username/password on both
> machine and is it an administrator account?
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> msdnmg@xxxxxx.
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscripti...t/default.aspx.
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> --------------------
Quote:

> >From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <eliassal@xxxxxx>
> >Subject: performancecounter object and remote server
> >Date: Tue, 27 May 2008 01:24:00 -0700
>
Quote:

> >
> >Has anybody worked with performancecounter object to access counters on
> >remote machine?
> >I managed to write code that retrieves counters categories froma remote
> >machine, when I try another remote machine I get
> >"System.ComponentModel.Win32Exception" error. Error message is
> >"The network path was not found."
> >I have checked running services (RPC, Remote registery.....) on both
> >machines and they are exactly the same.
> >I am wondering if there is anything to configure to allow access to
> counters
Quote:

> >remotly that I am missing on the 2nd machine.
> >The scenarion is as follows :
> >I have a workgroup,not a domain, 1 XP laptop (where I have VS 2005), 2
> >virtual win2k3 machines. when runing the code, the mentioned error happens
> at
Quote:

> >the following line
> >
> >Dim AllCountersCategories As PerformanceCounterCategory() =
> >PerformanceCounterCategory.GetCategories(strServerName)
> >
> >Regarding network connection, I can map a connection to both servers in
> >windows explorer. the user and password I use to log tomy XP machine are
> also
Quote:

> >created on both machines.
> >
> >The error message really doesn't give any clue why I am not able to
> retrieve
Quote:

> >the 2nd machines counters whereas it it works like a charm with the other
> >server.
> >Thanksd in advance
> >
> >
>
>
My System SpecsSystem Spec
Old 05-28-2008   #4 (permalink)
SalamElias


 
 

RE: performancecounter object and remote server

To be 100% sure, and in spite of the fact the the user is in admin group, I
added the user in the PERF mon group on the machine where I have problems, I
get exactly the same error

"Steven Cheng [MSFT]" wrote:
Quote:

> Hi Salam,
>
> From your description, you're using the .NET performance counter to open
> counters on remote machine, however, you got the following error, correct?
>
Quote:

> >"System.ComponentModel.Win32Exception" error. Error message is
> >"The network path was not found."
>
> based on my research, so far for remote performance counter accessing, the
> following blog entry has mentioned some information:
>
> #How to Read Performance Counters Without Administrator Privileges [Ryan
> Byington]
> http://blogs.msdn.com/bclteam/archiv...08/746900.aspx
>
> Also, as you mentioned the non-domain environment, I think it is also
> related to the problem. I've performenced tests on my side, in a domain
> environment, I can get the code you provided run correctly(event if I try
> running under a local account, has same username/password on both machine).
> Are you running through an account has same username/password on both
> machine and is it an administrator account?
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> msdnmg@xxxxxx.
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscripti...t/default.aspx.
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> --------------------
Quote:

> >From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <eliassal@xxxxxx>
> >Subject: performancecounter object and remote server
> >Date: Tue, 27 May 2008 01:24:00 -0700
>
Quote:

> >
> >Has anybody worked with performancecounter object to access counters on
> >remote machine?
> >I managed to write code that retrieves counters categories froma remote
> >machine, when I try another remote machine I get
> >"System.ComponentModel.Win32Exception" error. Error message is
> >"The network path was not found."
> >I have checked running services (RPC, Remote registery.....) on both
> >machines and they are exactly the same.
> >I am wondering if there is anything to configure to allow access to
> counters
Quote:

> >remotly that I am missing on the 2nd machine.
> >The scenarion is as follows :
> >I have a workgroup,not a domain, 1 XP laptop (where I have VS 2005), 2
> >virtual win2k3 machines. when runing the code, the mentioned error happens
> at
Quote:

> >the following line
> >
> >Dim AllCountersCategories As PerformanceCounterCategory() =
> >PerformanceCounterCategory.GetCategories(strServerName)
> >
> >Regarding network connection, I can map a connection to both servers in
> >windows explorer. the user and password I use to log tomy XP machine are
> also
Quote:

> >created on both machines.
> >
> >The error message really doesn't give any clue why I am not able to
> retrieve
Quote:

> >the 2nd machines counters whereas it it works like a charm with the other
> >server.
> >Thanksd in advance
> >
> >
>
>
My System SpecsSystem Spec
Old 05-28-2008   #5 (permalink)
Steven Cheng [MSFT]


 
 

RE: performancecounter object and remote server

Thanks for your reply Salam,

So the problem on your side is not specific to account's security
permission. Have you had a chance to test the same code on some machines
with domain setup? If possible, you can test it to see whether the problem
does be specific to the non-domain environment. And we can continue to
concentrate on this.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxx.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Quote:

>From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <eliassal@xxxxxx>
>References: <080E69DB-2E0B-4ADD-8834-3ED3B2487D90@xxxxxx>
<DDQNUgIwIHA.4216@xxxxxx>
Quote:

>Subject: RE: performancecounter object and remote server
>Date: Wed, 28 May 2008 02:27:01 -0700
Quote:

>
>Thanks Steven, I read the blog which has interesting information but it
>doesn't apply to my context.
>Yes, I am running through an account has same username/password on 3 mac
>hines and which are all declared in administrators group.
>So, I think I should not need to apply instructions mentioned in the blog
>
>"Steven Cheng [MSFT]" wrote:
>
Quote:

>> Hi Salam,
>>
>> From your description, you're using the .NET performance counter to open
>> counters on remote machine, however, you got the following error,
correct?
Quote:
Quote:

>>
Quote:

>> >"System.ComponentModel.Win32Exception" error. Error message is
>> >"The network path was not found."
>>
>> based on my research, so far for remote performance counter accessing,
the
Quote:
Quote:

>> following blog entry has mentioned some information:
>>
>> #How to Read Performance Counters Without Administrator Privileges [Ryan
>> Byington]
>> http://blogs.msdn.com/bclteam/archiv...08/746900.aspx
>>
My System SpecsSystem Spec
Old 05-29-2008   #6 (permalink)
SalamElias


 
 

RE: performancecounter object and remote server

Steven, currently I am working for a small size customer and he doesn't have
a domain. He has a workgroup of 8 servers.
I will see if I can setup a domain somewhere.
Isn't there a way to have more explicit information about the error itself
in VS?

"Steven Cheng [MSFT]" wrote:
Quote:

> Thanks for your reply Salam,
>
> So the problem on your side is not specific to account's security
> permission. Have you had a chance to test the same code on some machines
> with domain setup? If possible, you can test it to see whether the problem
> does be specific to the non-domain environment. And we can continue to
> concentrate on this.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> msdnmg@xxxxxx.
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> ications.
>
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
> --------------------
Quote:

> >From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <eliassal@xxxxxx>
> >References: <080E69DB-2E0B-4ADD-8834-3ED3B2487D90@xxxxxx>
> <DDQNUgIwIHA.4216@xxxxxx>
Quote:

> >Subject: RE: performancecounter object and remote server
> >Date: Wed, 28 May 2008 02:27:01 -0700
>
Quote:

> >
> >Thanks Steven, I read the blog which has interesting information but it
> >doesn't apply to my context.
> >Yes, I am running through an account has same username/password on 3 mac
> >hines and which are all declared in administrators group.
> >So, I think I should not need to apply instructions mentioned in the blog
> >
> >"Steven Cheng [MSFT]" wrote:
> >
Quote:

> >> Hi Salam,
> >>
> >> From your description, you're using the .NET performance counter to open
> >> counters on remote machine, however, you got the following error,
> correct?
Quote:
Quote:

> >>
> >> >"System.ComponentModel.Win32Exception" error. Error message is
> >> >"The network path was not found."
> >>
> >> based on my research, so far for remote performance counter accessing,
> the
Quote:
Quote:

> >> following blog entry has mentioned some information:
> >>
> >> #How to Read Performance Counters Without Administrator Privileges [Ryan
> >> Byington]
> >> http://blogs.msdn.com/bclteam/archiv...08/746900.aspx
> >>
>
>
My System SpecsSystem Spec
Old 05-29-2008   #7 (permalink)
SalamElias


 
 

RE: performancecounter object and remote server

I did more investigation on my 1st (the one which I manage to access) and 2nd
server (the one I can not access) and it seems that the problem is related to
PerformanceCounterCategory class .
I have setup a 3rd server, run my code against and it was successfull.
In my application I have a combo box which contains a list of servers with
which I like to work with.
So I had this 3rd server server as item(0) in combobox, the 2nd is the old
one (1st) which I always managed to access

So when I change the combobox to the 2nd server, I get exactly the same
error as for the server (2nd) that I was not able to access.

Here is the code I execute when item in combobox changes

Private Sub GetCounters()
Try
Dim strServerName =
cboServersList.Items(cboServersList.SelectedIndex).ToString.Replace("\", "")
Dim AllCountersCategories As PerformanceCounterCategory() =
PerformanceCounterCategory.GetCategories(strServerName)

'''Code taken for ease of read

Catch ex As Exception

Dim rethrow As Boolean = ExceptionPolicy.HandleException(ex,
"ComponentModel Policy")
If (rethrow) Then
' Throw original exception.
Throw
End If

End Try

End Sub

So it seems there is somwhere some context issues so the
PerformanceCounterCategory class is not able to update itself with counters
from another server.
I tried t play with the method clear but it didn't help.
So whats happening is the following : code execute correcely for 1st server
but not swicthing to another server

"Steven Cheng [MSFT]" wrote:
Quote:

> Thanks for your reply Salam,
>
> So the problem on your side is not specific to account's security
> permission. Have you had a chance to test the same code on some machines
> with domain setup? If possible, you can test it to see whether the problem
> does be specific to the non-domain environment. And we can continue to
> concentrate on this.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> msdnmg@xxxxxx.
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> ications.
>
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
> --------------------
Quote:

> >From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <eliassal@xxxxxx>
> >References: <080E69DB-2E0B-4ADD-8834-3ED3B2487D90@xxxxxx>
> <DDQNUgIwIHA.4216@xxxxxx>
Quote:

> >Subject: RE: performancecounter object and remote server
> >Date: Wed, 28 May 2008 02:27:01 -0700
>
Quote:

> >
> >Thanks Steven, I read the blog which has interesting information but it
> >doesn't apply to my context.
> >Yes, I am running through an account has same username/password on 3 mac
> >hines and which are all declared in administrators group.
> >So, I think I should not need to apply instructions mentioned in the blog
> >
> >"Steven Cheng [MSFT]" wrote:
> >
Quote:

> >> Hi Salam,
> >>
> >> From your description, you're using the .NET performance counter to open
> >> counters on remote machine, however, you got the following error,
> correct?
Quote:
Quote:

> >>
> >> >"System.ComponentModel.Win32Exception" error. Error message is
> >> >"The network path was not found."
> >>
> >> based on my research, so far for remote performance counter accessing,
> the
Quote:
Quote:

> >> following blog entry has mentioned some information:
> >>
> >> #How to Read Performance Counters Without Administrator Privileges [Ryan
> >> Byington]
> >> http://blogs.msdn.com/bclteam/archiv...08/746900.aspx
> >>
>
>
My System SpecsSystem Spec
Old 05-30-2008   #8 (permalink)
Steven Cheng [MSFT]


 
 

RE: performancecounter object and remote server

Thanks for your reply Salam,

As for the "context switching" problem, I think the performanceCounter
class should not have cached any context info when you switch servers. If
there is cached context, I think the following like code will also result
to the same error, correct?
Quote:
Quote:
Quote:

>>>>>>>>>>>>>>>>>>>>>>\
static void Run()
{
string[] servers = { "server1", "server2","server3".... };

foreach (string svr in servers)
{
PerformanceCounterCategory[] AllCountersCategories =
PerformanceCounterCategory.GetCategories(svr);

Console.WriteLine("{0}:
{1}",svr,AllCountersCategories.Length);
}
}
<<<<<<<<<<<<<<<<<<<<<<

Also, I found that the firewall setting may be a potential cause.
Especially for windows XP machine which enable firewall by default. By
default, the file share and many other protocols rely o the smb 445 port is
not enabled(or even enabled, your query machine is not in the same network
subnet with the target machine). These condition will result a "network
path was not found..." error. I've tested on my side and did find that
this will impact performance counter query. Here is a kb article mentioned
how to adjust the firewall setting(if enabled) on the target machine:

#How to configure Windows Firewall in Windows XP Service Pack 2 to allow
remote administration tools that use WMI, RPC, or DCOM
http://support.microsoft.com/kb/840634

#for the scope of filesharing setting, you can temporarly set it to allow
all internet computers(for test).

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxx.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Quote:

>From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <eliassal@xxxxxx>
>References: <080E69DB-2E0B-4ADD-8834-3ED3B2487D90@xxxxxx>
<DDQNUgIwIHA.4216@xxxxxx>
<98AACF04-5896-4F47-90F3-087BF48683C3@xxxxxx>
<c4G$VaTwIHA.4216@xxxxxx>
Quote:

>Subject: RE: performancecounter object and remote server
>Date: Thu, 29 May 2008 09:41:01 -0700
Quote:

>
>I did more investigation on my 1st (the one which I manage to access) and
2nd
Quote:

>server (the one I can not access) and it seems that the problem is related
to
Quote:

> PerformanceCounterCategory class .
>I have setup a 3rd server, run my code against and it was successfull.
>In my application I have a combo box which contains a list of servers with
>which I like to work with.
>So I had this 3rd server server as item(0) in combobox, the 2nd is the old
>one (1st) which I always managed to access
>
>So when I change the combobox to the 2nd server, I get exactly the same
>error as for the server (2nd) that I was not able to access.
>
>Here is the code I execute when item in combobox changes
>
>Private Sub GetCounters()
> Try
> Dim strServerName =
>cboServersList.Items(cboServersList.SelectedIndex).ToString.Replace("\",
"")
Quote:

> Dim AllCountersCategories As PerformanceCounterCategory() =
>PerformanceCounterCategory.GetCategories(strServerName)
>
>'''Code taken for ease of read
>
> Catch ex As Exception
>
> Dim rethrow As Boolean = ExceptionPolicy.HandleException(ex,
>"ComponentModel Policy")
> If (rethrow) Then
> ' Throw original exception.
> Throw
> End If
>
> End Try
>
> End Sub
>
>So it seems there is somwhere some context issues so the
>PerformanceCounterCategory class is not able to update itself with
counters
Quote:

>from another server.
>I tried t play with the method clear but it didn't help.
>So whats happening is the following : code execute correcely for 1st
server
Quote:

>but not swicthing to another server
>
My System SpecsSystem Spec
Old 05-31-2008   #9 (permalink)
SalamElias


 
 

RE: performancecounter object and remote server

Steven, thanks for your efforts. However, I think this KB doesn't apply to
this situation.
Windows firewall is disabled on my XP box as well as target w2K3 machines.
Also, just want to remind you that if there were any issue with firewall, I
should have never been able to connect the first round with any one of them.
As I said, when code is run for first time,it connects correctlybut not when
switching.
I will use your code in a standalone executable and see if I get the same
error for the 2nd server and let you know.

"Steven Cheng [MSFT]" wrote:
Quote:

> Thanks for your reply Salam,
>
> As for the "context switching" problem, I think the performanceCounter
> class should not have cached any context info when you switch servers. If
> there is cached context, I think the following like code will also result
> to the same error, correct?
>
Quote:
Quote:

> >>>>>>>>>>>>>>>>>>>>>>\
> static void Run()
> {
> string[] servers = { "server1", "server2","server3".... };
>
> foreach (string svr in servers)
> {
> PerformanceCounterCategory[] AllCountersCategories =
> PerformanceCounterCategory.GetCategories(svr);
>
> Console.WriteLine("{0}:
> {1}",svr,AllCountersCategories.Length);
> }
> }
> <<<<<<<<<<<<<<<<<<<<<<
>
> Also, I found that the firewall setting may be a potential cause.
> Especially for windows XP machine which enable firewall by default. By
> default, the file share and many other protocols rely o the smb 445 port is
> not enabled(or even enabled, your query machine is not in the same network
> subnet with the target machine). These condition will result a "network
> path was not found..." error. I've tested on my side and did find that
> this will impact performance counter query. Here is a kb article mentioned
> how to adjust the firewall setting(if enabled) on the target machine:
>
> #How to configure Windows Firewall in Windows XP Service Pack 2 to allow
> remote administration tools that use WMI, RPC, or DCOM
> http://support.microsoft.com/kb/840634
>
> #for the scope of filesharing setting, you can temporarly set it to allow
> all internet computers(for test).
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> msdnmg@xxxxxx.
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> ications.
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> --------------------
Quote:

> >From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <eliassal@xxxxxx>
> >References: <080E69DB-2E0B-4ADD-8834-3ED3B2487D90@xxxxxx>
> <DDQNUgIwIHA.4216@xxxxxx>
> <98AACF04-5896-4F47-90F3-087BF48683C3@xxxxxx>
> <c4G$VaTwIHA.4216@xxxxxx>
Quote:

> >Subject: RE: performancecounter object and remote server
> >Date: Thu, 29 May 2008 09:41:01 -0700
>
Quote:

> >
> >I did more investigation on my 1st (the one which I manage to access) and
> 2nd
Quote:

> >server (the one I can not access) and it seems that the problem is related
> to
Quote:

> > PerformanceCounterCategory class .
> >I have setup a 3rd server, run my code against and it was successfull.
> >In my application I have a combo box which contains a list of servers with
> >which I like to work with.
> >So I had this 3rd server server as item(0) in combobox, the 2nd is the old
> >one (1st) which I always managed to access
> >
> >So when I change the combobox to the 2nd server, I get exactly the same
> >error as for the server (2nd) that I was not able to access.
> >
> >Here is the code I execute when item in combobox changes
> >
> >Private Sub GetCounters()
> > Try
> > Dim strServerName =
> >cboServersList.Items(cboServersList.SelectedIndex).ToString.Replace("\",
> "")
Quote:

> > Dim AllCountersCategories As PerformanceCounterCategory() =
> >PerformanceCounterCategory.GetCategories(strServerName)
> >
> >'''Code taken for ease of read
> >
> > Catch ex As Exception
> >
> > Dim rethrow As Boolean = ExceptionPolicy.HandleException(ex,
> >"ComponentModel Policy")
> > If (rethrow) Then
> > ' Throw original exception.
> > Throw
> > End If
> >
> > End Try
> >
> > End Sub
> >
> >So it seems there is somwhere some context issues so the
> >PerformanceCounterCategory class is not able to update itself with
> counters
Quote:

> >from another server.
> >I tried t play with the method clear but it didn't help.
> >So whats happening is the following : code execute correcely for 1st
> server
Quote:

> >but not swicthing to another server
> >
>
>
My System SpecsSystem Spec
Old 06-02-2008   #10 (permalink)
Steven Cheng [MSFT]


 
 

RE: performancecounter object and remote server

Thanks for your reply Salam,

If the same code works first but fails in sequential calls, that does be a
bit unexpected. So far based on my research, I haven't found any similar
records describing the same symptom. I think the problem is likely be
specific to the particular environment(both client and target server). If
the problems remains after you verified on different machines and with
different code/project, I would suggest you contact CSS for further
professional incident based support due to the requirement of further
complex troubleshooting:

Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxx.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Quote:

>From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <eliassal@xxxxxx>
>References: <080E69DB-2E0B-4ADD-8834-3ED3B2487D90@xxxxxx>
<DDQNUgIwIHA.4216@xxxxxx>
<98AACF04-5896-4F47-90F3-087BF48683C3@xxxxxx>
<c4G$VaTwIHA.4216@xxxxxx>
<07A7156A-EA2D-440C-A2DD-635921B63B52@xxxxxx>
<BA$$Y$iwIHA.4564@xxxxxx>
Quote:

>Subject: RE: performancecounter object and remote server
>Date: Sat, 31 May 2008 10:10:00 -0700
Quote:

>
>Steven, thanks for your efforts. However, I think this KB doesn't apply to
>this situation.
>Windows firewall is disabled on my XP box as well as target w2K3 machines.
>Also, just want to remind you that if there were any issue with firewall,
I
Quote:

>should have never been able to connect the first round with any one of
them.
Quote:

>As I said, when code is run for first time,it connects correctlybut not
when
Quote:

>switching.
>I will use your code in a standalone executable and see if I get the same
>error for the 2nd server and let you know.
>
>"Steven Cheng [MSFT]" wrote:
>
Quote:

>> Thanks for your reply Salam,
>>
>> As for the "context switching" problem, I think the performanceCounter
>> class should not have cached any context info when you switch servers.
If
Quote:
Quote:

>> there is cached context, I think the following like code will also
result
Quote:
Quote:

>> to the same error, correct?
>>
Quote:

>> >>>>>>>>>>>>>>>>>>>>>>\
>> static void Run()
>> {
>> string[] servers = { "server1", "server2","server3".... };
>>
>> foreach (string svr in servers)
>> {
>> PerformanceCounterCategory[] AllCountersCategories =
>> PerformanceCounterCategory.GetCategories(svr);
>>
>> Console.WriteLine("{0}:
>> {1}",svr,AllCountersCategories.Length);
>> }
>> }
>> <<<<<<<<<<<<<<<<<<<<<<
>>
>> Also, I found that the firewall setting may be a potential cause.
>> Especially for windows XP machine which enable firewall by default. By
>> default, the file share and many other protocols rely o the smb 445 port
is
Quote:
Quote:

>> not enabled(or even enabled, your query machine is not in the same
network
Quote:
Quote:

>> subnet with the target machine). These condition will result a "network
>> path was not found..." error. I've tested on my side and did find that
>> this will impact performance counter query. Here is a kb article
mentioned
Quote:
Quote:

>> how to adjust the firewall setting(if enabled) on the target machine:
>>
>> #How to configure Windows Firewall in Windows XP Service Pack 2 to allow
>> remote administration tools that use WMI, RPC, or DCOM
>> http://support.microsoft.com/kb/840634
>>
>> #for the scope of filesharing setting, you can temporarly set it to
allow
Quote:
Quote:

>> all internet computers(for test).
>>
>> Sincerely,
>>
>> Steven Cheng
>>
>>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Failing Object creation from vbs-script on Windows Server 2008 VB Script
From Virtual Server, Unable to connect to Remote SQL Server 2008 D Virtual Server
new-object cmdlet and remote com objects PowerShell
There is no such object on the server VB Script
Adding canonical aliases for Compare-Object, Measure-Object, New-Object PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46