Newbie WMI with ASP.NET?

B

Bishop

Any ideas on why I'm getting the error?

This subroutine works on my Vista workstation:
Sub DisplaySessionData()
Dim wmi, wql, instance, instances
wmi = GetObject("winmgmts:root/cimv2")
wql = "Select * from Win32_PerfRawData_ASPNET_ASPNET"

instances = wmi.ExecQuery(wql)
Response.Write("Count: " & instances.count & "<br />")
For Each instance In instances
Response.Write("Active Sessions: " &
instance.StateServerSessionsActive & " <br />")
Response.Write("Queued Requests: " & instance.RequestsQueued & "
<br />")
Response.Write("Current Requests: " & instance.RequestsCurrent &
" <br />")
Response.Write("Request Execution Time: " &
instance.RequestExecutionTime & " <br />")
Next
End Sub

When I upload to the Windows 2003 Server I get the following error:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Invalid class
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Invalid
class

Source Error:


Line 21:
Line 22: instances = wmi.ExecQuery(wql)
Line 23: Response.Write("Count: " & instances.count & "<br />")
Line 24: For Each instance In instances
Line 25: Response.Write("Active Sessions: " &
instance.StateServerSessionsActive & " <br />")


Source File: c:\inetpub\serverinfo\Home.aspx.vb Line: 23

Stack Trace:


[COMException (0x80041010): Invalid class ]
Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type
objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack) +965
Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) +367036
Home.DisplaySessionData() in c:\inetpub\serverinfo\Home.aspx.vb:23
Home.Page_Load(Object sender, EventArgs e) in
c:\inetpub\serverinfo\Home.aspx.vb:13
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
 
D

David Glienna

Download ScriptMatic by the Scripting Guys at Microsoft. It writes VBS
scripts for you (to translate)

- David\
 
R

Rich Quackenbush

It looks like there is a difference in the class names between Vista and Server 2003 (either that our the performance counter class that your hitting on Vista just plain doesn't exist in 2003).

To find out if that's the case, load up perfmon and look at the available counters on your server machine. Odds are that they won't have all of the counters that you have on your Vista machine.

Good luck!



Bishop wrote:

Newbie WMI with ASP.NET?
14-Jan-09

Any ideas on why I'm getting the error?

This subroutine works on my Vista workstation:
Sub DisplaySessionData()
Dim wmi, wql, instance, instances
wmi = GetObject("winmgmts:root/cimv2")
wql = "Select * from Win32_PerfRawData_ASPNET_ASPNET"

instances = wmi.ExecQuery(wql)
Response.Write("Count: " & instances.count & "<br />")
For Each instance In instances
Response.Write("Active Sessions: " &
instance.StateServerSessionsActive & " <br />")
Response.Write("Queued Requests: " & instance.RequestsQueued & "
<br />")
Response.Write("Current Requests: " & instance.RequestsCurrent &
" <br />")
Response.Write("Request Execution Time: " &
instance.RequestExecutionTime & " <br />")
Next
End Sub

When I upload to the Windows 2003 Server I get the following error:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Invalid class
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Invalid
class

Source Error:


Line 21:
Line 22: instances = wmi.ExecQuery(wql)
Line 23: Response.Write("Count: " & instances.count & "<br />")
Line 24: For Each instance In instances
Line 25: Response.Write("Active Sessions: " &
instance.StateServerSessionsActive & " <br />")


Source File: c:\inetpub\serverinfo\Home.aspx.vb Line: 23

Stack Trace:


[COMException (0x80041010): Invalid class ]
Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type
objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack) +965
Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) +367036
Home.DisplaySessionData() in c:\inetpub\serverinfo\Home.aspx.vb:23
Home.Page_Load(Object sender, EventArgs e) in
c:\inetpub\serverinfo\Home.aspx.vb:13
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433;
ASP.NET Version:2.0.50727.1433

Previous Posts In This Thread:

Newbie WMI with ASP.NET?
Any ideas on why I'm getting the error?

This subroutine works on my Vista workstation:
Sub DisplaySessionData()
Dim wmi, wql, instance, instances
wmi = GetObject("winmgmts:root/cimv2")
wql = "Select * from Win32_PerfRawData_ASPNET_ASPNET"

instances = wmi.ExecQuery(wql)
Response.Write("Count: " & instances.count & "<br />")
For Each instance In instances
Response.Write("Active Sessions: " &
instance.StateServerSessionsActive & " <br />")
Response.Write("Queued Requests: " & instance.RequestsQueued & "
<br />")
Response.Write("Current Requests: " & instance.RequestsCurrent &
" <br />")
Response.Write("Request Execution Time: " &
instance.RequestExecutionTime & " <br />")
Next
End Sub

When I upload to the Windows 2003 Server I get the following error:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Invalid class
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Invalid
class

Source Error:


Line 21:
Line 22: instances = wmi.ExecQuery(wql)
Line 23: Response.Write("Count: " & instances.count & "<br />")
Line 24: For Each instance In instances
Line 25: Response.Write("Active Sessions: " &
instance.StateServerSessionsActive & " <br />")


Source File: c:\inetpub\serverinfo\Home.aspx.vb Line: 23

Stack Trace:


[COMException (0x80041010): Invalid class ]
Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type
objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack) +965
Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) +367036
Home.DisplaySessionData() in c:\inetpub\serverinfo\Home.aspx.vb:23
Home.Page_Load(Object sender, EventArgs e) in
c:\inetpub\serverinfo\Home.aspx.vb:13
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433;
ASP.NET Version:2.0.50727.1433

Download ScriptMatic by the Scripting Guys at Microsoft.
Download ScriptMatic by the Scripting Guys at Microsoft. It writes VBS
scripts for you (to translate)

- David\


Submitted via EggHeadCafe - Software Developer Portal of Choice
ASP.NET MVC RC2
http://www.eggheadcafe.com/tutorials/aspnet/1a32540c-062b-49b8-8233-31135243bfdb/aspnet-mvc-rc2.aspx
 
R

Rich Quackenbush

It looks like there is a difference in the class names between Vista and Server 2003 (either that our the performance counter class that your hitting on Vista just plain doesn't exist in 2003).

To find out if that's the case, load up perfmon and look at the available counters on your server machine. Odds are that they won't have all of the counters that you have on your Vista machine.

Good luck!



Bishop wrote:

Newbie WMI with ASP.NET?
14-Jan-09

Any ideas on why I'm getting the error

This subroutine works on my Vista workstation
Sub DisplaySessionData(
Dim wmi, wql, instance, instance
wmi = GetObject("winmgmts:root/cimv2"
wql = "Select * from Win32_PerfRawData_ASPNET_ASPNET

instances = wmi.ExecQuery(wql
Response.Write("Count: " & instances.count & "<br />"
For Each instance In instance
Response.Write("Active Sessions: " &
instance.StateServerSessionsActive & " <br />"
Response.Write("Queued Requests: " & instance.RequestsQueued & "
<br />"
Response.Write("Current Requests: " & instance.RequestsCurrent &
" <br />"
Response.Write("Request Execution Time: " &
instance.RequestExecutionTime & " <br />"
Nex
End Su

When I upload to the Windows 2003 Server I get the following error
Server Error in '/' Application
-------------------------------------------------------------------------------

Invalid clas
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code

Exception Details: System.Runtime.InteropServices.COMException: Invalid
clas

Source Error

Line 21
Line 22: instances = wmi.ExecQuery(wql
Line 23: Response.Write("Count: " & instances.count & "<br />"
Line 24: For Each instance In instance
Line 25: Response.Write("Active Sessions: " &
instance.StateServerSessionsActive & " <br />"

Source File: c:\inetpub\serverinfo\Home.aspx.vb Line: 2

Stack Trace

[COMException (0x80041010): Invalid class
Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type
objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack) +96
Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) +36703
Home.DisplaySessionData() in c:\inetpub\serverinfo\Home.aspx.vb:2
Home.Page_Load(Object sender, EventArgs e) in
c:\inetpub\serverinfo\Home.aspx.vb:1
System.Web.UI.Control.OnLoad(EventArgs e) +9
System.Web.UI.Control.LoadRecursive() +4
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +143


-------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433;
ASP.NET Version:2.0.50727.1433

Previous Posts In This Thread:

Newbie WMI with ASP.NET?
Any ideas on why I'm getting the error

This subroutine works on my Vista workstation
Sub DisplaySessionData(
Dim wmi, wql, instance, instance
wmi = GetObject("winmgmts:root/cimv2"
wql = "Select * from Win32_PerfRawData_ASPNET_ASPNET

instances = wmi.ExecQuery(wql
Response.Write("Count: " & instances.count & "<br />"
For Each instance In instance
Response.Write("Active Sessions: " &
instance.StateServerSessionsActive & " <br />"
Response.Write("Queued Requests: " & instance.RequestsQueued & "
<br />"
Response.Write("Current Requests: " & instance.RequestsCurrent &
" <br />"
Response.Write("Request Execution Time: " &
instance.RequestExecutionTime & " <br />"
Nex
End Su

When I upload to the Windows 2003 Server I get the following error
Server Error in '/' Application.
--------------------------------------------------------------------------------

Invalid class
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Invalid
class

Source Error:


Line 21:
Line 22: instances = wmi.ExecQuery(wql)
Line 23: Response.Write("Count: " & instances.count & "<br />")
Line 24: For Each instance In instances
Line 25: Response.Write("Active Sessions: " &
instance.StateServerSessionsActive & " <br />")


Source File: c:\inetpub\serverinfo\Home.aspx.vb Line: 23

Stack Trace:


[COMException (0x80041010): Invalid class ]
Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type
objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack) +965
Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) +367036
Home.DisplaySessionData() in c:\inetpub\serverinfo\Home.aspx.vb:23
Home.Page_Load(Object sender, EventArgs e) in
c:\inetpub\serverinfo\Home.aspx.vb:13
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433;
ASP.NET Version:2.0.50727.1433

Download ScriptMatic by the Scripting Guys at Microsoft.
Download ScriptMatic by the Scripting Guys at Microsoft. It writes VBS
scripts for you (to translate)

- David\

Try using perfmon to look at the WMI classes on the server
It looks like there is a difference in the class names between Vista and Server 2003 (either that our the performance counter class that your hitting on Vista just plain doesn't exist in 2003).

To find out if that's the case, load up perfmon and look at the available counters on your server machine. Odds are that they won't have all of the counters that you have on your Vista machine.

Good luck!


Submitted via EggHeadCafe - Software Developer Portal of Choice
How to reference Assemblies in the GAC
http://www.eggheadcafe.com/tutorial...3-4e258f164faa/how-to-reference-assembli.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top