Forcing Dr. Watson via WMI from asp.net web app

D

Dr. StrangeDub

I'm looking for a way to force a service to take Dr. Watson dump and
terminate from within an asp.net web application (in C#).

A bit of background: I am try to code a web/WMI equivalent to an
existing C++ utility that we developed to force a Dr. Watson. The C++
version simply uses --
HRESULT result = ControlService( hService, command, &status );
where command is set to 128.
I figured I could simply call the Win32_BaseService.UserControlService
(WMI) and pass in 128 (type byte) for the control code. This returns a
error status = 21, which is Invalid Parameter.

Is the UserControlService simply catching the case where an undefined
user control code is passed in, whereas ControlService takes an
exception in the same case? If so, what's an alternative way to force
a Dr. Watson from C#? If not, do you have any idea what I may be
doing wrong?

Any and all help, or links to possible answers, greatly appreciated.

-Michael Rose
Unisys Corp.
 
D

Dr. StrangeDub

A colleague of mine came up with a very simple answer:

string serviceName = "someservicename";
System.ServiceProcess.ServiceController sc = null;
sc = new System.ServiceProcess.ServiceController( serviceName );

if( sc != null )
{
try
{
sc.ExecuteCommand( 128 );
}
catch( System.Exception e )
{
System.Console.WriteLine( "Exception " + e.Message );
}
}

Note that in order to get this to compile, you'll need to add a
reference that includes the namespace System.ServiceProcess, which can
be found in the .NET component System.ServiceProcess.dll.

One note: as this is not using WMI it will only kill services on the
local machine -- that is, where the web is hosted.

Michael Rose
-Unisys Corp.
 
D

Dr. StrangeDub

A colleague of mine came up with a very simple answer:

string serviceName = "someservicename";
System.ServiceProcess.ServiceController sc = null;
sc = new System.ServiceProcess.ServiceController( serviceName );

if( sc != null )
{
try
{
sc.ExecuteCommand( 128 );
}
catch( System.Exception e )
{
System.Console.WriteLine( "Exception " + e.Message );
}
}

Note that in order to get this to compile, you'll need to add a
reference that includes the namespace System.ServiceProcess, which can
be found in the .NET component System.ServiceProcess.dll.

One note: as this is not using WMI it will only kill services on the
local machine -- that is, where the web is hosted.

Michael Rose
-Unisys Corp.

==================
 

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

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top