473,386 Members | 1,786 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,386 software developers and data experts.

Getting System.ServiceProcess.ServiceController.ExecuteCom mand(int) to work

What do I have to do to get
System.ServiceProcess.ServiceController.ExecuteCom mand(int) to work?

I have written a service that overrides OnCustomCommand to handle commands
sent to it.

If I have application code like:

----------------------------------------------------------
ServiceController sc = new ServiceController("MyService");

sc.Start(); // this works

...code that checks running state is here...

sc.ExecuteCommand(1); //throws the exception

---------------------------------------------------------

I get an exception of: Cannot control MyService service on computer "."

Are there specific things i have to do to the service to allow it to accept
commands other than the standard start, stop, etc?

Thanks in Advance....Tom J


Nov 15 '05 #1
1 4056
User defined control codes must be =>128 and <= 255. The operating system
reserves numbers under 128.

Willy
"Tom J" <tj******@centersoftcom.com> wrote in message
news:OJ**************@TK2MSFTNGP12.phx.gbl...
What do I have to do to get
System.ServiceProcess.ServiceController.ExecuteCom mand(int) to work?

I have written a service that overrides OnCustomCommand to handle commands
sent to it.

If I have application code like:

----------------------------------------------------------
ServiceController sc = new ServiceController("MyService");

sc.Start(); // this works

...code that checks running state is here...

sc.ExecuteCommand(1); //throws the exception

---------------------------------------------------------

I get an exception of: Cannot control MyService service on computer "."

Are there specific things i have to do to the service to allow it to accept commands other than the standard start, stop, etc?

Thanks in Advance....Tom J

Nov 15 '05 #2

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

Similar topics

2
by: Eyal | last post by:
Hey, I would appriciate if anyone can help on this one: I have a java object/inteface having a method with a boolean parameter. As I'm trying to call this method from a javascript it fails on...
0
by: chan | last post by:
how to apply online update function into program (the effect just like Norton system work live update) The situation is below: I want to develop a program that contains some product...
1
by: Srinvias Vikram | last post by:
hai, how can we get Work Sheet in Excel and can place it in Word Document through C# progrmming, if any solution please give me Reply,I really Appreciate your help. Regards, srinvias vikram
3
by: rasa | last post by:
I am able to instantiate and make calls to a com module that use only primitive data types, but I simply don't know what the c# equivalent is for a function expecting short*. Any help would be...
4
by: Zephyr . via .NET 247 | last post by:
(Type your message here) -------------------------------- From: Zephyr . hey, i got trouble getting integers out of a plain text file. i dont want to use binary files, just plain text files...
29
by: john | last post by:
I read in the first question in the FAQ that both short and int are guaranteed to be able to hold values up to 32,767. Then why would one use an int instead of a short if short takes less space?
6
by: Dan Holmes | last post by:
I have a class that i need a constraint of int, string, float or bool. I have tried the following but can't make VS accept it. I read the docs and they showed that any value type can be used...
3
by: Whooty | last post by:
Hello, im kind of new in using C++ and I have a question, I tried some tutorials and eventualy came to the part where the system namespace is used, but for some reason it won't work, #include...
23
by: student.matt | last post by:
ok i am trying to solve this little problem i have my program waits for the 1st system() call to finish before starting the next i will just throw an example of what i mean out in this example...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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.