|
-
Jun 25th, 2003, 12:29 AM
#1
Thread Starter
Fanatic Member
Windows Service: GUI to Control Service...
hey guys,
With VB.NET, making windows services seems to be extremely easy! However, I'm in need of more than the basic windows service.... I really need to make a gui for my windows service, but i'm not sure what the proper way to do this is....
let me first explain my program. It is basically a tcp/ip server (for a business messaging program i've made). I started making the server program in a normal windows application project, and then i recently decided i should change it into a windows service.
So, in my program, i currently have a nice form that handles the gui. This form displays information on the status of the application (number of connected users, uptime, server notifications, etc). and it also controls options on the server in realtime (like IP Connection Masking, maximum connections, etc.).
This leads me to how to make the GUI... what is the proper way? Should i make a whole different application apart from the service? (doing this only seems to allow the application to start/stop/pause windows services, not actually interact with them in any more detail)...
My guess is i need to add a windows form to the windows service project. If i do this, how do i implement the form? i really don't know how to do this... any help is appreciated... i haven't been able to find any good reading on this problem specifically..
thanks guys!
-
Jun 25th, 2003, 03:00 AM
#2
I don't know if this is the best solution or not but you could remote an object from the service so that any applications could connect to it that way and handle the UI.
-
Jun 25th, 2003, 10:23 AM
#3
Addicted Member
For the last few services I created, I just created a separate applications the "service administrator/manager utility". I found that it was just easier to work with that way and I could provided updates to the GUI or service, without having to edit the other, etc.
You can't have GUIs (forms, message boxes, etc.) in your service, unless you check "allow service to interact with desktop" for that service.
-
Jun 25th, 2003, 10:35 AM
#4
Thread Starter
Fanatic Member
Ok,
So i will probably need to make a seperate program for my service. This is ok with me, my only question now then is how exactly do i interact with the windows service. Like i said, I need to be able to pull and push information to the service.
The only logical thing i can think of right now is to interact via updating the settings XML file or something like that. Please share your thoughts on this idea:
All server settings are stored in an XML file. I could have the Windows Service setup a file watcher on that Settings file, so that whenever the Settings file is changed, the service reloads all of the server settings from the settings file. Then, from the Admin Utitlity, it would be as simple as changing settings in that Settings file whenever Something needs to be changed.
To Get information from the windows service i could do something similar. I could have a ServerStatus XML File, that whenever something changes in the server, the server status file is changed. On the Admin Utility i would then setup a file watcher on the status file. Whenever the status file changes, the file watcher will catch it and the admin utility will be updated from the status file.
Obviously, this solution would work, and I think it would work just fine. The only thing i don't like about it is the second part of it. Using XML files in this manner is not the fastest solution. And the server status could be VERY frequently updated, so writing to and reading from an XML file every second or more often could be a bad thing. Can anyone suggest a better way to do this part of it? Perhaps some kind of IPC? I'm not sure if remoting is right for this or not, but I'm not sure i want to use remoting for this either :/
Thanks so much for the help granted already, and whatever else you guys may contribute
-
Jun 25th, 2003, 12:35 PM
#5
Lively Member
(doing this only seems to allow the application to start/stop/pause windows services, not actually interact with them in any more detail)...
How do you check for a service runing and restart and stop the service?
Thanks
-
Jun 25th, 2003, 03:07 PM
#6
Addicted Member
Originally posted by cgj
How do you check for a service runing and restart and stop the service?
Thanks
http://www.vbforums.com/showthread.p...hreadid=246890
-
Jun 25th, 2003, 05:43 PM
#7
Lively Member
i have one problem,
System.ServiceProcess
is not working try it,
-
Jun 25th, 2003, 06:23 PM
#8
Addicted Member
Works fine for me. Make sure you have it referenced and imported properly.
Right click on References (in solution explorer),
then choose "Add reference",
then choose "System.ServiceProcesses".
Next insert "Imports System.ServiceProcess" at the top of your class/module, etc.
-
Jun 25th, 2003, 08:23 PM
#9
Lively Member
Thanks Shurijo
It works
do you know how to check the status?
thanks
-
Jun 26th, 2003, 09:06 AM
#10
Thread Starter
Fanatic Member
I'd still like a bit more info on how i should attempt my situation. I've concluded that i can send the service information via Custom Command that Windows Services use.
So now my only problem is sending stats of the service back to the Admin utility. Again, I don't think remoting is the best solution here, but rather i would think some kind of Inter-Process Communication would be appropriate. Anybody have ideas?
-
Sep 14th, 2003, 08:11 PM
#11
Frenzied Member
Redth,
I want to do the same thing with my service. How did all this end up?
TIA,
Mike
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|