开发者

Windows Service with WPF management tool

i'm trying to create a windows service with C# in .net that runs before the user is logged on... then when a user is logged on a symbol should appear in the system tray (next to the clock) to show the us开发者_如何学Goer that the service is running.. by double clicking that symbol a configuration utility (written in wpf) should be shown to the user, so he can configure the service, read data from it and so on ..

is there a possibility to do this within one application?

thanks in advance for any help!!!


No, you can't do this with one application as services run with a different user in a different session. You need to create two applications and implement some communication between both.

I would not recommend using named pipes directly (like Kieren Johnstone suggested), but to have a look at WCF which was designed for interprocess communication and nicely abstracts implementation details of the communication technology away from you. Here is a link that can propably help you with WCF: http://www.switchonthecode.com/tutorials/wcf-tutorial-basic-interprocess-communication.

Best Regards,
Oliver Hanappi


Within one application, no. Services run in session 0, please see here:

http://www.microsoft.com/whdc/system/sysinternals/session0changes.mspx

Your best bet is to used Named Pipes, see here:

http://www.switchonthecode.com/tutorials/dotnet-35-adds-named-pipes-support

....or a memory mapped file, see here:

http://msdn.microsoft.com/en-us/library/dd997372.aspx

Within the scope of more-.NETty, you could also use Remoting. You'll need to come up with some interface or protocol to facilitate communication between the service and the management utility. Managing the process start/stop would be easier and you could use the ServiceController class (MSDN ref).

Hope that helps (and itsn't too discouraging)!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜