Click here to Skip to main content
15,849,829 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Is there something special about making a Windows service run as a WCF client?

I've written the following:

- A Winforms app that acts as a WCF ServiceHost

- A Winforms app that acts as a WCF client

- A Windows service that acts as a WCF client

The WCF stuff uses NamedPipe Binding.

When I run the winforms client app, it communicates with the service host app just fine. If I try the very same code with the Windows service, it doesn't seem to be able to find the service host (endpoint not found).

All of the WCF stuff lives in its own assembly to make sure I'm using the same Uri and binding, and all three of the apps listed above use that assembly. I have no idea why the service wouldn't work when the winforms client app *would*.
Posted

1 solution

John,

I believe this is by design. Since your WCF service is running as a non-Admin user, the named pipe endpoint it creates will not be globally accessible by apps running in other sessions.

To test this out, run your WinForms app explicitly as Administrator (using the Run as Administrator option). Now you'll most likely find that the Windows service WCF client can connect to it.

As far as I know, there's no real workaround to this issue other than choosing a different binding mechanism.
 
Share this answer
 
Comments
#realJSOP 1-Feb-11 13:22pm    
Well, that let 'em talk to each other. I can't imagine that changing the binding would change that. I don't want the winforms app to have to be run as administrator...
#realJSOP 1-Feb-11 14:03pm    
It's looking like I'm going to have to go with a non-WCF solution.
Nish Nishant 1-Feb-11 14:09pm    
If named-pipes are not an absolute requirement, you might want to try an http based binding scheme.
#realJSOP 1-Feb-11 16:18pm    
Same restriction
Nish Nishant 1-Feb-11 16:23pm    
Wow, that sucks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900