|
-
Oct 8th, 2009, 03:09 PM
#1
Thread Starter
Addicted Member
WCF: Communicating with the ServiceHost?
Hey
This one's bugging me. I'm building a WCF service so that I can issue work to multiple clients and retrieve results back on the server (wsDualHttpBinding with callbacks). The WCF service is hosted in a WPF application using a ServiceHost.
I am curious how I communicate with the service from within the WPF application? Would I have to connect to the endpoint like the clients would have to? Once the clients have registered their callback with the service, i'd like to be able to invoke those callbacks from within the WPF app.
If the facts don't fit the theory, change the facts. --Albert Einstein
-
Oct 8th, 2009, 04:00 PM
#2
Re: WCF: Communicating with the ServiceHost?
Someone asked the same thing not long ago, see if their thread helps you at all: http://www.vbforums.com/showthread.php?t=584272
-
Oct 8th, 2009, 04:32 PM
#3
Thread Starter
Addicted Member
Re: WCF: Communicating with the ServiceHost?
Ah, i missed that thread. That gave me an idea... Singleton.
Step 1: Set the service to a singleton (which is what i really want):
Code:
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.Single)]
Step 2: Set up the service
Code:
WCFService workService = new WCFService(controller);
ServiceHost host = new ServiceHost(workService);
host.Open();
Step 3: Call the service method
Code:
workService.CallMethod();
Thanks... the help is much appreciated. I feel silly for missing that. I didn't realise I could start the service with an instantiated object.
If the facts don't fit the theory, change the facts. --Albert Einstein
-
Oct 8th, 2009, 04:53 PM
#4
Re: WCF: Communicating with the ServiceHost?
Glad I could help point you in the right direction
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|