I've been new to c# and windows services. I've been studying for about a month and been doing a lot of basic stuff. I just want to confirm this issue to you guys. How would it applied to windows services? Would it be possible for IPC mechanism like the clipboard to be applied in some of the services? Thanks! :)

Recommended Answers

All 9 Replies

In addition, why is it a bad idea to integrate windows services and UIs? Thanks again.

Its a bad idea to integrate an interface with your service as many computers block services having access to forms and the like for security reasons.

All I know is that it's possible for normal VS applications like the clipboard component. Would it be possible too for windows services?

You already asked this and got responses.

I'm sorry if I posted it again, because the only question that was answered was why is it a bad idea to put a ui to windows services. I still got lots of confusion with regards to this issue.

Well, what part of the previous answers didnt you get? respond to them, ask the questions about the specifics you dont understand..

The problem with windows service as LizR has stated is security. Services are started up as different user accounts, than the logged on user, although they can be set with the logged on user. I think you are thinking about the application in the wrong context trying to get it to use a service. Services should require no user interaction whatsoever. You should be able to do the same thing with an actual application that is set to run on startup for the user, not a service.

Wow...Having a bad day LizR? Any reason why you would answer the second question first, and then berate the asker when he tries to get information on the original question?

Anyway, there are plenty of reasons why you would want IPC in a Windows Service. I would definitely stay away from the clipboard, as that is just simply too error prone since it has a global scope. The only method of IPC that won't work in my experience however, is using the WM_COPYDATA enum with the SendMessage() function, mainly because Windows Services don't have a window handle to send the message to.

I would suggest using sockets for IPC with a Windows Service.

Murderotica, I hope your questions are received with a little more civility and grace in the future.

I personally don't recommend sockets for IPC communication with services because it adds a level of complexity when dealing with firewalls (read the quickbooks FAQ on getting their modules to sync up, they use IPC communication over sockets and have many articles devoted on how to fix what constantly breaks).

Another approach is using named pipes and a complete implmentation example is available at:
http://www.codeproject.com/KB/threads/dotnetnamedpipespart1.aspx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.