Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Windows Services
Hi masters,
 
I want to create a windows service that run in background automatically when system boot.
I can do it well, now I want to call a function in my service from my app when for example a button clicked. And that function returns something to my app from the running service.
 
I have looked on the Internet and found a few examples about creating a Windows Service, building installers, and registering the service; however, I cannot seem to find any documentation on how to interact with running services via a different application.
 
Now how do I do this?
 
Thanks.
Posted 18-Jun-13 22:09pm
Edited 18-Jun-13 22:14pm
Johnny J.115.6K
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
Johnny J. at 19-Jun-13 3:15am
   
This is not what the OP wants. He said that he already knows this! Please reread the question!
The_Leader at 19-Jun-13 4:03am
   
tnx johnny.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

That's not the way a windows service works. A windows service is basically a program that runs silently (and UI-less) in the background to perform certain tasks. You can't interact with it (well, you might be able to, but it's not meant to work that way).
 
What you are thinking of is a web service that is hosted on a web server and provides you with data from a given data storage (typically a database).
 
What do you want to return to your app?
 
If it is some information about the local system, then why do you need a service for it when your program just as well can retrieve the information itself?
 
And if it is remote information you need to return, you will want to create a web service and host it remotely...
 
[EDIT] If I can give you a tip for future questions: Your keyboard has a CAPS button. Use it! Writing a text in all lower case is sloppy and disrespectful. At least capitalize the first letter in the sentence and "I" of course. [/EDIT]
  Permalink  
v4
Comments
The_Leader at 19-Jun-13 4:13am
   
Thanks Johnny about the explanation. I want to return for example a File Stream. But my goal is use the service for encryption and decryption my data instead of using DLL, for more security and avoiding of dll decompiling.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 19 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100