Reputation: 789
(c#, .net framework 2.0 desired)
Hello.
This is a pratical and technical question... you have been warned. :)
I have a windows service, which requires each user to provide a login to an online service. Lets imagine we have two users a and b.
a runs the installation process, which at the end asks for the login credentials for the online serive. Stores it locally and ding, when the service starts it knows the user.
b comes along, logs off a, logs themself on. The service notices a new user, checks to see if it has login details, figures out it doesn't.
I thought I could use Process.Start to fire up a windows app. nope. So I googled and it looks like if I write a bunch of code (shown here as CreateProcessAsUser ) it's possible, but not advised to do this.
So... what should I do? Happy for any technical or pratical solutions.
Upvotes: 1
Views: 106
Reputation: 10418
Showing any kind of user interface from within a service is not only discouraged, but even explicitly prevented in some Windows platforms (windows Server 2008 comes to my mind).
The common approach for this task is to develop two independet modules, a Windows Service and a GUI application that communicates with the services using one of the many IPC schemes available, depending on the complexity of the data to be transfered. A loopback WCF (Web Service) for example could be a good approach.
If implemented properly, this solution will also work in complex scenarios like multiple terminal services sessions.
Upvotes: 1