So as I understand your question you have the following setup:
-An GUI Controller app running on the user desktop that is able to start/stop, etc... your Windows Service.
-A Windows Service running on the Windows Service Desktop.
And you would like to figure out a better way to communicate with your service from the user desktop.
If I remember right, a Windows Service Process cannot communicate directly with a process running on the User's desktop because the Windows Service Process is running in a seperate hidden non-gui window station. However, both the service and the front-end app share the same file system. One way that you could try to enable communication from your Service to your Controller app is to have a file somewhere that both the Service and Controller knows about. The Service modifies this file as it runs to update it with whatever changes and metadata you wish. The Controller app would then need to use FileSystemWatcher (under the System.IO namespace) class to monitor that file for changes. When a change happens, you go and read the file and have the Controller app do whatever it needs to. You will probably have to lock the file for reading and writing and have your Service and Controller wait while the file is in use by its counterpart to prevent weird syncronization problems. To have the Controller communicate with the Service, just use another file and have the Service watch for changes in it.
To do it other ways, you may need to go into unmanaged APIs. Look up "Windows Services" and "Window Stations" to learn more about how.
Main Topics
Browse All Topics





by: NetPointerPosted on 2004-04-19 at 10:53:07ID: 10861891
Remoting ???