I am making a service that is going to run开发者_开发百科 on a Windows server 2008 R2 box. Now the thing i'm wondering about is how would I sort out the configurtation of the service. Is it possible to integrate a gui for the service in the server manager? If so how? Or is there a better way if configuring the service?
If you really want to create a GUI that integrates with the management experience of Windows you have to create a Microsoft Management Console for your service. However, you may find that the effort required is more than you want to invest. In that case you can create your own GUI using WPF, Windows Forms or whatever you are comfortable using.
In most cases you want a solution where the service reads the configuration from a source (registry or file system) and the GUI simply modifies this source. The service should monitor the source for updates submitted by the GUI.
Another solution is to let the service only read the configuration during startup. You GUI then needs to be able to restart the service to allow the service to pick up the changes.
Simplest way to do this i think is:
Service:
Write the pure service with no GUI.
Have this service read settings from either Applicationd data configuration file or registry ( I would use Registry if it was just a few settings).
GUI application:
Write a simple UI application that configures the settings.
Have a option in the application to restart the service.
精彩评论