开发者

C# modify a config file for a windows service

开发者 https://www.devze.com 2022-12-31 23:46 出处:网络
I have a windows service that reads from a config file. I need to modify th开发者_JS百科is config file prior to the application starting. How can I create a GUI that would handle the changes to the co

I have a windows service that reads from a config file. I need to modify th开发者_JS百科is config file prior to the application starting. How can I create a GUI that would handle the changes to the config file. I know that a service does not have a GUI per se, but I really just need something to modify some strings in the config file and then start the service.


You can open the configuration and manipulate it programatically...

Configuration cfg = ConfigurationManager.OpenExeConfiguration("your path here");
// perform unspeakable acts upon cfg using your GUI
cfg.Save();

Update to elaborate on comments:

Generally when I need to provide a UI for a service, I expose a wcf channel using a net.tcp endpoint, which does not require special priveledges, and write a simple tray icon app to talk to it. Quick and easy compared to previous strategies.

0

精彩评论

暂无评论...
验证码 换一张
取 消