当前位置: 动力学知识库 > 问答 > 编程问答 >

C# Windows Form with Attached Windows Service

问题描述:

I know how I can create a Windows Service in C# but I have a series of variables that the user currently feeds into a text file and I wanted to control this process. So can I attach a Windows service to a Windows form application to control such things as installing the service, uninstalling the service, start and restart. Or is it better to have them completely separate and just use the form app to run system commands for install/uninstall and use the serviceController to start/restart?

Thanks

网友答案:

I suggest to make it completely separated.

网友答案:

It's probably better to keep them separate: have the form write a config file for the service, then either restart the service or have the service detect the changed file and reconfigure itself.

If the service interacts with the desktop, then you'll have to start worrying about what happens if they're running as different users, or if there isn't a logged-on user at all, or...

网友答案:

You can do it by allowing the service to interact with the desktop. It's an acceptable way of doing it, but saying that, I agree with dario-g!

分享给朋友:
您可能感兴趣的文章:
随机阅读: