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

Send a message to a Windoes services

Hi,
I have a Windows Service in VB.NET and now I need to send a message to
it from a different PC. How can I do this in a very simple way? (No SQL or
other external way), I need to talk directly to the service.
Thanks.
George.
Nov 21 '05 #1
4 1005
In article <et**************@tk2msftngp13.phx.gbl>, George D. Lake wrote:
Hi,
I have a Windows Service in VB.NET and now I need to send a message to
it from a different PC. How can I do this in a very simple way? (No SQL or
other external way), I need to talk directly to the service.
Thanks.
George.


Well, there are a couple of things you can do... The first, and
probably simplist way is to make use of the ServiceController class.
You can get a reference to the service through the constructor:

Imports System.ServiceProcess

....

Dim controller As New ServiceController ("servicename", "machinename")

This will let you use the ExecuteCommand method on the service... The
limitation is that the command is an integer value only. So, if you
need to send additional parameters, you can't really use this method
(unless you can some how encode them into an integer)...

' exectue a custom command on the service
controller.ExecuteCommand (23)

If that won't work for you... There is always Sockets and Remoting as
alternatives.

--
Tom Shelton [MVP]
Nov 21 '05 #2
Tom,

This will work, all I need to do it to manually trigger an event, so I
can send a 1 and that will do the trick

So, on the client side I would do what you said, but on the service
side? How do I capture that command?

Thanks.
George.
Well, there are a couple of things you can do... The first, and
probably simplist way is to make use of the ServiceController class.
You can get a reference to the service through the constructor:

Imports System.ServiceProcess

...

Dim controller As New ServiceController ("servicename", "machinename")

Nov 21 '05 #3
In article <e2**************@TK2MSFTNGP14.phx.gbl>, George D. Lake wrote:
Tom,

This will work, all I need to do it to manually trigger an event, so I
can send a 1 and that will do the trick

So, on the client side I would do what you said, but on the service
side? How do I capture that command?

Thanks.
George.


In your service class, you would override your services OnCustomCommand
method...

Protected Override Sub OnCustomCommand (ByVal command As Integer)

HTH
--
Tom Shelton [MVP]
Nov 21 '05 #4
Thanks....
Now I have a permissions problem.

I need to impersonate form the client, the domain user that is running that
service.
I have done that in ASP.NET but I gant get it to work in win forms.

"Tom Shelton" <to*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:e$*************@TK2MSFTNGP12.phx.gbl...
In article <e2**************@TK2MSFTNGP14.phx.gbl>, George D. Lake wrote:
Tom,

This will work, all I need to do it to manually trigger an event, so
I
can send a 1 and that will do the trick

So, on the client side I would do what you said, but on the service
side? How do I capture that command?

Thanks.
George.


In your service class, you would override your services OnCustomCommand
method...

Protected Override Sub OnCustomCommand (ByVal command As Integer)

HTH
--
Tom Shelton [MVP]

Nov 21 '05 #5

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

Similar topics

4
by: CK | last post by:
Hi all, I know this question is stupid. But i need some advice for this. I am trying to develop a website, which will allow the user send to order form to the admin email. I am planning to use the...
3
by: Sara | last post by:
HI, I want to code a program to detect GSM mobile (any kind) which connected through serial port to computer and then be able to send SMS through this mobile phone to other mobile phones, could...
5
by: Malik Asif Joyia | last post by:
Hello How we can send the email alerts automatically.. mean on a specific date and time. thanks
0
by: Markus Poehler | last post by:
Hi there! I have created NT Service that runs on a Server. It should NET SEND to a specifiv Client in a special case of environment. It does NOT net send. The Messenger Service is running....
6
by: Yoel | last post by:
Hi, I'm trying consuming web services over SSL by an ASP .Net client without success. System Architecture: My Server side contains the following layers, starting from the client side: ...
5
by: RG | last post by:
I have an aspx web pages which interacts with an asmx service. The calls to web service are done via Javascript. The asmx service method has the following parameters: public string...
0
by: Nanker | last post by:
I would like to integrate Reporting Services reports into an existing email messaging framework using .NET 1.1 (both to leverage the existing framework and since the error reporting by Reporting...
4
by: Joseph Geretz | last post by:
We use a Soap Header to pass a token class (m_Token) back and forth with authenticated session information. Given the following implementation for our Logout method, I vastly prefer to simply code...
2
by: radom | last post by:
i got a computer given to me that had virus and well it wont in to windoes so i put my linux disk and it locks up is there any way to delete windoes so i get delete the virus and put linux on it I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.