Do you have allow anonymous access turned on? - if so IIS is probably trying to run 
the code under the security context of the IUSR_MACHINENAME account.

-----Original Message-----
From: Mattias Konradsson [mailto:[EMAIL PROTECTED]]
Sent: 15 April 2002 13:39
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Measuring performance


>>From: "Donal Devine" <[EMAIL PROTECTED]>
>>Can you post the code?

 public void Page_Load(Object sender, EventArgs e)
  {

    TimeSpan tsStart =
Process.GetCurrentProcess().Threads[0].UserProcessorTime;

    int c = 0;

    for (int i=0;i<1000;i++)
     {
      c++;
     }

    TimeSpan tsDuration =
Process.GetCurrentProcess().Threads[0].UserProcessorTime.Subtract(tsStart);
    Response.Write(tsDuration.ToString());

  }

 Sure, here's an stripped down example, I first thought it might just work
in components and not in aspx pages but I get the Access Denied for both:


[Win32Exception (0x80004005): Access is denied]
   System.Diagnostics.PerformanceMonitor.GetData(String item) +371
   System.Diagnostics.PerformanceCounterLib.GetPerformanceData(String item)
+150
   System.Diagnostics.PerformanceCounterLib.get_CategoryTable() +80
   System.Diagnostics.PerformanceCounterLib.GetPerformanceData(String[]
categories, Int32[] categoryIndexes) +56
   System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLib
library) +157

[InvalidOperationException: Couldn't get process information from remote
machine.]
   System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLib
library) +258
   System.Diagnostics.NtProcessManager.GetProcessInfos(String machineName,
Boolean isRemoteMachine) +152
   System.Diagnostics.ProcessManager.GetProcessInfos(String machineName) +37
   System.Diagnostics.Process.EnsureState(State state) +269
   System.Diagnostics.Process.get_Threads() +31
   ASP.measure_aspx.Page_Load(Object sender, EventArgs e) in
d:\inetpub\wwwroot\existic\measure.aspx:26
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +29
   System.Web.UI.Page.ProcessRequestMain() +724



mvh
----
Mattias Konradsson
"Reinventing the wheel since 1977"

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to