Solved

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

Posted on 2002-04-14
5
338 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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 have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

21 Experts available now in Live!

Get 1:1 Help Now