Waiting for completion of one-way WCF call in a C# console application -
i have wcf webservice (not under control) implements functionality need access via isoneway=true + callback interface, 1 of methods of notifies of processing completion. has been written way designed access gui.
however need access same method console application use in batch. crude method of achieving set flag false , after calling wcf method implement while loop brief thread.sleep() call in it. works seems poor way of achieving end result.
i'd know proper way of doing is. note: service out of control , reference has been added through ide although can knockup code implementation etc.
use manualresetevent waiting completion. call one-way async method on service , wait on manualresetevent object. in callback call set() method let main thread continue execution after waitone() call so:
var waithandle = new manualresetevent(); yourwcfobject.calltheonewaymethod(); waithandle.waitone(); void callbackmethodraisedbywcfservice() { waithandle.set(); }
Comments
Post a Comment