Solved

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

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

815 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

9 Experts available now in Live!

Get 1:1 Help Now