NOT ANSWERED - ServiceBase.OnCustomCommand and ServiceController.ExecuteCommand
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngescalate' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Matthew R. Belk
-- This message, which was originally sent to "aspngbeta", has been moved to "aspngescalate" mailing list by the List Master --

Hello,

I am trying to use the ServiceController.ExecuteCommand(Integer) /
ServiceBase.OnCustomCommand(Integer) methods to communicate with a
Windows
Service that I wrote. The OnCustomCommand receives the appropriate
command identifier (in this case, 128), but I can't figure a way to
return any kind of information back to the calling program. It's like
the service is cut off from communicating back to the outside world.

I have tried returning data by throwing an ApplicationException with my
return data as the message of the exception, but that doesn't work, or
at least I can't get at the information. There are no Win32Exceptions,
InvalidOperationExceptions, or general Exceptions being thrown by the
service, since I am catching those as well as the desired
ApplicationException.

Is there some other way to accomplish this?

Any help would be appreciated. The MSDN library documentation is pretty
sparse, as is the literature I can find in other sources.

Thanks,
Matthew

Matthew Belk
BizSpeed, Inc., www.bizspeed.com
4555 Mansell Rd., Ste 300
Alpharetta, GA 30022
770.521.4262

Reply to this message...
 
    
Mitch Denny (VIP)
Matthew,

I replied to this when you originally posted it to the [aspngfreeforall]
list on the Saturday the 4th of August. In case you missed it, the gist
of what I was saying in the message is that you probably aren't going to
be able to do it, because it wasn't intended for inter-process
communication
of that nature, in fact, the custom command functionality isn't
recommended
for use from what I understand.

In order to build your own interface to the service, try doing remoting
over the HTTP channel with a SOAP formatter. The SDK documentation go
through this better than I could, so take a look at the following
URL for more information and an example (watch for wrapping):
http://localhost/QuickStart/howto/default.aspx?url=/quickstart/howto/doc
/Remoting/firstserver.aspx

Once you have done that, you can build a client for it. The best way
to do that in my opinion is to get the system to build a prototype for
you, take a look at the SOAPSUDS command. More information on this is
available in the SDK documentation.

If you post some of your code I can probably give you a more
concete example of how to approach it (post to me privately if
it is easier).

I did some crude testing and I managed to saw through about 1000
requests in 11 seconds. Thats not bad.

----------------------------------------
- Mitch Denny
- http://www.warbyte.com
- Click here to reveal e-mail address
- +61 (414) 610-141
-

[Original message clipped]

Reply to this message...
 
 
System.ApplicationException
System.ServiceProcess.ServiceBase
System.ServiceProcess.ServiceController




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com