infobachir
New Member
Hi Scott,<BR><BR>I read your article on Displaying Performance Monitor Information and tried it out. It works fine by itself. However, once I run it, I can not open any other browser windows (they hang) and VS.NET crashes. Any ideas why this would be happening? Here is the small test file I was running:<BR>---------------------------------------------<BR><%@ Page Language="vb" %><BR><%@ Import Namespace = System.Diagnostics %><BR><script runat="server"><BR><BR> sub Page_Load(sender as Object, e as EventArgs)<BR> Dim perfWebUptime as New PerformanceCounter("Web Service", "Service Uptime", "_Total")<BR> Dim perfUsers as New PerformanceCounter("Web Service", "Current Anonymous Users", "_Total") <BR> Dim perfReceived as New PerformanceCounter("Web Service", "Bytes Received/sec", "_Total")<BR> Dim perfSent as New PerformanceCounter("Web Service", "Bytes Sent/sec", "_Total")<BR> <BR> lblWebUptime.Text = perfWebUptime.NextValue()<BR> lblUsers.Text = perfUsers.NextValue()<BR> lblRec.Text = perfReceived.NextValue()<BR> lblSent.Text = perfSent.NextValue()<BR> <BR> perfWebUptime = nothing<BR> perfUsers = nothing<BR> perfReceived = nothing<BR> perfSent = nothing<BR> end sub<BR><BR></script><BR><html><BR> <head><BR> </head><BR> <body><BR> <form runat="server" ID="Form1"><BR> <table border="1" cellpadding="4" cellspacing="0"><BR> <tr><BR> <td>Web Service Uptime:<BR> </td><BR> <td><asp:Label id="lblWebUptime" runat="server"></asp:Label></td><BR> </tr><BR> <tr><BR> <td>Anon Users:</td><BR> <td><asp:Label ID="lblUsers" Runat="server" /></td><BR> </tr><BR> <tr><BR> <td>Bytes Sent:</td><BR> <td><asp:Label ID="lblSent" Runat="server" /></td><BR> </tr><BR> <tr><BR> <td>Bytes Received:</td><BR> <td><asp:Label ID="lblRec" Runat="server" /></td><BR> </tr><BR> </table><BR> </form><BR> </body><BR></html><BR>---------------------------------------------------<BR>TIA,<BR>ChrisHuh, that's quite odd. Since you are using VS.NET try debugging via VS.NET. Set a breakpoint in your server-side code and step through it to see if you can isolate at what line it's happening. Have you tried a simplified version of this, perhaps one that just uses one perf counter? Try cutting and pasting the code from the article... does that work?Thanks for your response, Scott. I copied the code from the tutorial and had the same results. I stepped through it and found that I can not open new browser windows right after the first two lines of code execute:<BR> Dim perfAppRestarts as New PerformanceCounter("ASP.NET", "Application Restarts")<BR> Dim perfFreeMem as New PerformanceCounter("Memory", "Available MBytes")<BR><BR>Same results with just one counter. Perhaps it is my machine. This problem is not that important to me. I just thought it was cool to run. I am going to abandon this for the time being. Thanks again!<BR>