4

I'm currently working on a project in c# where I have a service running as LocalSystem, and a user application (tray app) running for each logged on user.

I need to have communications between the two. Initially I've set up an endpoint using NetTcpBinding on the service for the clients to connect to and supply their username. Thereafter the clients each set up an endpoint themselves as such; net.tcp://localhost:5001/UserApp/'username', with port sharing enabled. The service can then connect to that endpoint, knowing the username.

Though, when trying to get the program to work well with UAC I ran into some issues. Port sharing with UAC enabled requires the user to be registred in <'allowAccounts> of SMSvcHost.exe.config, and even though I've added the user, I still get the following errror when trying to register the endpoint;

The service endpoint failed to listen on the URI 'net.tcp://localhost:5001/UserApp/myuser' because access was denied. Verify that the current user is granted access in the appropriate allowAccounts section of SMSvcHost.exe.config.

I've also tried switching to NetNamedPipeBinding, which works well when hosting the user application. But when using this binding the service can not access the endpoints opened by the clients.

So, basically I need a way for a single service to provide an endpoint for multiple user applications on the same machine, and the service to be able to connect to and send event updates to multiple user applications.

Any suggestions?

4

2 回答 2

2

在这种情况下,我会考虑使用回调通道而不是在客户端上打开新服务(好的 - 几乎相同,但它非常适合 WCF 框架和设置)。你可以在这里阅读:关于单向调用、回调和事件你需要了解的内容

于 2011-09-08T12:00:04.013 回答
0

您可能还想查看 Duplex 服务,特别是“wsDualHttpBinding”。它旨在满足您的要求……允许服务和客户端相互独立地发送消息。

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

于 2011-09-08T13:22:56.157 回答