c# - WCF: Windows service cannot find endpoint when hosted in Winforms application -
i require windows service make wcf calls service hosted in winforms application.
unfortunately when attempting call windows service fails discover endpoint.
i have tried changing log on properties windows service allow interaction desktop, did not help.
i have used exact same hosting code (as used winforms app) in console application , windows service finds endpoint no problem.
any appreciated...
code host service in winforms app.
_myservicehost = new servicehost(typeof(myservice); _myservicehost.addserviceendpoint ( typeof (imyservice), new netnamedpipebinding(), @"net.pipe://localhost/myservice" ); _myservicehost.open();
code client proxy...
_servicefactory = new channelfactory<imyservice> ( new netnamedpipebinding(), "net.pipe://localhost/myservice" ); ... imyservice clientproxy = _servicefactory.createchannel(); clientproxy.somemethod();
this problem appear to security context in windows services run preventing endpoint hosted winforms app being visible service not vica versa.
update:
i tried changing binding netnamedpipebinding nettcpbinding , seems work fine type of binding.
are sure have app.config in place , have opened service host? issue must in that. , windows service has no role here, check wcftestclient , try view wsdl (if enabled) in web browser.
but believe have not opened host :
servicehost host = new servicehost(....); host.open(); // check called
Comments
Post a Comment