473,387 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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.

Jul 21 '05 #1
2 2623
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.
On Wed, 01 Oct 2003 13:45:27 -0500, Dr. StrangeDub
<st********@yahoo.com> wrote:
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.


Jul 21 '05 #2
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.

==================
On Wed, 01 Oct 2003 13:45:27 -0500, Dr. StrangeDub
<st********@yahoo.com> wrote:
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.


Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Julie Paten | last post by:
Hello, I receive an Inetinfo.exe dr. watson error when I run any .dll from any client computer. I have tried installing sp6a on my NT4 server but the error keeps coming up and halting my...
0
by: Barak Turovsky | last post by:
Hi all, I have a web site running on IIS 4.0 on Windows NT 4.0 Server. The site is working perfectly for 3 years. Recently i have a strange problem while the IIS is crashing giving the Dr....
3
by: Greg B | last post by:
Created a simple Win32 application (using Visual Studio wizard)... Am using Visual Studio (Enterprise Edition) 6.0, as well as Service Pack 5. At the start of 'WinMain' function, added the...
1
by: Oliver | last post by:
I have a database developed fully in Access 2000 which I make available to users of both Access 97 and Access 2000. I use a split front end/back end arrangement; with the BE in Access 97. When I...
10
by: Steven | last post by:
The following program runs alright until the return statement, where it crashes, and consequently, Dr. Watson (drwtsn32.exe) also crashes. Deleting the call to fgets() and everything runs fine. I...
0
by: Bob Allen | last post by:
I have a few programs out that are getting the following error. This error only started since people have done the last windows updates in the past week. I appears that it is only affecting...
2
by: Dr. StrangeDub | last post by:
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...
5
by: Hazzard | last post by:
..aspx pages work fine and vsnet.2003 runs fine with all functionality(edit,build, execute, etc) except when I try to open a .html file in the project or a .xml file. Dr. Watson comes up...
0
by: markusa | last post by:
Hello all, my .NET 1.1 application runs on many desktop pc and sometimes produces a crash which is recorded by dr. watson. Although I log all exceptions at least in the Main method and in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.