By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,985 Members | 2,884 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,985 IT Pros & Developers. It's quick & easy.

performancecounter object and remote server

P: n/a
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(strServer Name)

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

Jun 27 '08 #1
Share this Question
Share on Google+
11 Replies


P: n/a
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?
>"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:
ms****@microsoft.com.

==================================================
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.

--------------------
>From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <el******@online.nospam>
Subject: performancecounter object and remote server
Date: Tue, 27 May 2008 01:24:00 -0700
>
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(strServe rName)

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

Jun 27 '08 #2

P: n/a
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:
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?
"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:
ms****@microsoft.com.

==================================================
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.

--------------------
From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <el******@online.nospam>
Subject: performancecounter object and remote server
Date: Tue, 27 May 2008 01:24:00 -0700

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(strServer Name)

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

Jun 27 '08 #3

P: n/a
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:
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?
"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:
ms****@microsoft.com.

==================================================
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.

--------------------
From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <el******@online.nospam>
Subject: performancecounter object and remote server
Date: Tue, 27 May 2008 01:24:00 -0700

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(strServer Name)

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

Jun 27 '08 #4

P: n/a
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:
ms****@microsoft.com.

==================================================
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.
--------------------
>From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <el******@online.nospam>
References: <08**********************************@microsoft.co m>
<DD**************@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: performancecounter object and remote server
Date: Wed, 28 May 2008 02:27:01 -0700
>
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:
>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?
>>
>"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
Jun 27 '08 #5

P: n/a
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:
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:
ms****@microsoft.com.

==================================================
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.
--------------------
From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <el******@online.nospam>
References: <08**********************************@microsoft.co m>
<DD**************@TK2MSFTNGHUB02.phx.gbl>
Subject: RE: performancecounter object and remote server
Date: Wed, 28 May 2008 02:27:01 -0700

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:
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?
>
"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

Jun 27 '08 #6

P: n/a
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(strServer Name)

'''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:
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:
ms****@microsoft.com.

==================================================
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.
--------------------
From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <el******@online.nospam>
References: <08**********************************@microsoft.co m>
<DD**************@TK2MSFTNGHUB02.phx.gbl>
Subject: RE: performancecounter object and remote server
Date: Wed, 28 May 2008 02:27:01 -0700

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:
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?
>
"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

Jun 27 '08 #7

P: n/a
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?
>>>>>>>>>>>>>>>>>>>>>>\
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:
ms****@microsoft.com.

==================================================
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.

--------------------
>From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <el******@online.nospam>
References: <08**********************************@microsoft.co m>
<DD**************@TK2MSFTNGHUB02.phx.gbl>
<98**********************************@microsoft.co m>
<c4**************@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: performancecounter object and remote server
Date: Thu, 29 May 2008 09:41:01 -0700
>
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(strServe rName)

'''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
Jun 27 '08 #8

P: n/a
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:
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?
>>>>>>>>>>>>>>>>>>>>>\
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:
ms****@microsoft.com.

==================================================
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.

--------------------
From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <el******@online.nospam>
References: <08**********************************@microsoft.co m>
<DD**************@TK2MSFTNGHUB02.phx.gbl>
<98**********************************@microsoft.co m>
<c4**************@TK2MSFTNGHUB02.phx.gbl>
Subject: RE: performancecounter object and remote server
Date: Thu, 29 May 2008 09:41:01 -0700

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(strServer Name)

'''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

Jun 27 '08 #9

P: n/a
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:
ms****@microsoft.com.

==================================================
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.

--------------------
>From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <el******@online.nospam>
References: <08**********************************@microsoft.co m>
<DD**************@TK2MSFTNGHUB02.phx.gbl>
<98**********************************@microsoft.co m>
<c4**************@TK2MSFTNGHUB02.phx.gbl>
<07**********************************@microsoft.co m>
<BA**************@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: performancecounter object and remote server
Date: Sat, 31 May 2008 10:10:00 -0700
>
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:
>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?
>>>>>>>>>>>>>>>>>>>>>>\
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

Jun 27 '08 #10

P: n/a
Steven, your code snippet helped me pinpoint the issue. In fact it is a
stupide bug inside my code.
A space is getting introduced in the server name when I am trying to
retrieve servers names from my app.config file. I don't know why but when I
added (Ltrim(Rtrim(Servername))) code executed like a charm.
So this confirms your findings, many thanks for your help. I will
investigate why I am having this space from the xml file.

Best regards,

"Steven Cheng [MSFT]" wrote:
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:
ms****@microsoft.com.

==================================================
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.

--------------------
From: =?Utf-8?B?U2FsYW1FbGlhcw==?= <el******@online.nospam>
References: <08**********************************@microsoft.co m>
<DD**************@TK2MSFTNGHUB02.phx.gbl>
<98**********************************@microsoft.co m>
<c4**************@TK2MSFTNGHUB02.phx.gbl>
<07**********************************@microsoft.co m>
<BA**************@TK2MSFTNGHUB02.phx.gbl>
Subject: RE: performancecounter object and remote server
Date: Sat, 31 May 2008 10:10:00 -0700

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:
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?

>>>>>>>>>>>>>>>>>\
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


Jun 27 '08 #11

P: n/a
Thanks for your reply Salam,

Really glad to hear that you've figured out the issue. And I'm also abit
surprised that the cause is due to the space in server name. Anyway, that's
fine that everything is working now. It's a pleasure to help you.

Have a nice day!

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:
ms****@microsoft.com.

==================================================
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.
--------------------
>Subject: RE: performancecounter object and remote server
Date: Mon, 2 Jun 2008 03:35:00 -0700
>
Steven, your code snippet helped me pinpoint the issue. In fact it is a
stupide bug inside my code.
A space is getting introduced in the server name when I am trying to
retrieve servers names from my app.config file. I don't know why but when
I
>added (Ltrim(Rtrim(Servername))) code executed like a charm.
So this confirms your findings, many thanks for your help. I will
investigate why I am having this space from the xml file.

Best regards,

"Steven Cheng [MSFT]" wrote:
>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:
ms****@microsoft.com.

================================================= =
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.
>>
--------------------
Jun 27 '08 #12

This discussion thread is closed

Replies have been disabled for this discussion.