Solved

More problems accessing performance monitor information on remote machine from ASP.NET using C#

Posted on 2002-04-14
5
339 Views
Last Modified: 2007-12-19
Okay well I have gotten the code at the bottom to work but only for the Web server it is installed on, which is also the domain controller. I haven't been able to get it to give any information on any other machine.

When I try I get the following:

Exception Details: System.ComponentModel.Win32Exception: Access is denied

I had to set up permission for the ASPNET user to be able to read the perflib registry key. But it only seems to work for the local machine and not any domain machine.

Can someone please help me solve this issue.

Thanks everyone,
Chris Craft


<!--#include virtual="/library/functionlibrary.aspx"-->
<%@ Import Namespace = System.Diagnostics %>

<script runat="server">

  void Page_Load( Object Src, EventArgs E )
  {
    PerformanceCounter perfFreeMem = new PerformanceCounter( "Memory", "Available MBytes", "", "Arena3" );
    lblFreeMem.Text = perfFreeMem.NextValue().ToString();
  }

</script>

<html>
<head>
</head>
<body>
    <form runat="server">
        <p>
            Application Restarts:  
            <asp:Label id="lblAppRestarts" runat="server"></asp:Label>
        </p>
        <p>
            Free Memory (in MB):
            <asp:Label id="lblFreeMem" runat="server"></asp:Label>
        </p>
    </form>
</body>
</html>
0
Comment
Question by:CJCraft
  • 2
  • 2
5 Comments
 
LVL 20

Expert Comment

by:Silvers5
ID: 6940439
you'll need to assign a doman admin for that
0
 
LVL 20

Expert Comment

by:Silvers5
ID: 6940445
or assign a user with same credentials as a local admin on the remote machine
0
 
LVL 11

Accepted Solution

by:
ASPGuru earned 200 total points
ID: 6940534
Have a look at this Classes/enumerations:

System.Diagnostics.PerformanceCounterPermission
System.Diagnostics.PerformanceCounterPermissionAccess
System.Diagnostics.PerformanceCounterPermissionAttribute
System.Diagnostics.PerformanceCounterPermissionEntry
System.Diagnostics.PerformanceCounterPermissionEntryCollection

ASPGuru
0
 
LVL 7

Author Comment

by:CJCraft
ID: 6940907
Isn't there some way I could give my ASPNET domain user access rights to the registry key perflib on the other machines? I think that is what is stopping it.

I got it to work fine on the Web / Domain server itself.

I'll look in to those enumerations too, thanks.

Chris
0
 
LVL 11

Expert Comment

by:ASPGuru
ID: 6941158
i don't know if it works by setting rights on registry keys...

try it with the domain administrator account first, maybe that works, then if you know that it works, you can try it with another account or removing rights as long as it still works...

ASPGuru
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now