I am currently working on a project in C #, where I have a service running on LocalSystem and a user application (application for trays) running for each registered user.
I need to have a connection between them. First, I set up an endpoint using NetTcpBinding to serve clients to connect and provide a username. After that, clients themselves configured the endpoint as such; net.tcp: // localhost: 5001 / UserApp / 'username', with port sharing enabled. The service can then connect to this endpoint, knowing the username.
Although, trying to get the program to work with UAC, I ran into some problems. Sharing ports with UAC enabled requires that the user logs into <'allowAccounts> from the SMSvcHost.exe.config file, and although I added the user, I still get the following error message when I try to register the endpoint;
The service endpoint could not listen on the URI 'net.tcp: // localhost: 5001 / UserApp / myuser' because access was denied. Make sure that the current user is granted access in the appropriate allowAccounts in the SMSvcHost.exe.config file.
I also tried switching to NetNamedPipeBinding, which works well when hosting a custom application. But using this binding, a service cannot access endpoints opened by clients.
So, basically, I need a way for a single service to provide an endpoint for several user applications on the same computer, and the service should be able to connect and send event updates for several user applications.
Any suggestions?
source share