|
-
Mar 13th, 2009, 04:33 AM
#1
Thread Starter
Hyperactive Member
WCF: Callback and streaming
I want to use a callback contract and streaming in the same WCF service. Can I do this by just adding a wsDualHttpBinding endpoint and a basicHttpBinding endpoint (with streaming enabled) or do I need to do something else? Will the client automatically know which endpoint to use when requesting an operation that requires streaming?
-
Mar 13th, 2009, 05:41 AM
#2
Re: WCF: Callback and streaming
Your client needs to explicitly specify which endpoint it's going to use, when you make the call. If you're trying to do a callback then I presume you'll specify the CallbackContract attribute. If you do that, then you can't use basicHttpBinding because it's... er... basic. It can't do callbacks. You'll need to limit your service to expose just wsDualHttpBinding for that particular service contract.
-
Mar 13th, 2009, 06:20 AM
#3
Thread Starter
Hyperactive Member
Re: WCF: Callback and streaming
How can I specify on the client which endpoint it is to use for a specific call?
Do I have to create a second service that uses the basicHttpBinding, or can the existing service just be exposed by 2 endpoints?
Hmmm.... Can I create a service class that implements 2 interfaces, one for each service contract?
I love to learn new things. 
[edit]
How about the client? The client class currently inherits from DuplexClientBase(Of <MyServiceType>), and it obviously can't inherit from another base type.
[/edit]
Last edited by Hamish; Mar 13th, 2009 at 06:27 AM.
-
Mar 13th, 2009, 12:39 PM
#4
Re: WCF: Callback and streaming
From a client, you can use the basic http endpoint like so:
Code:
EndpointAddress epa = new EndpointAddress("http://example.com/myservice.svc);
MyService.MyServiceClient client = new MyService.MyServiceClient(new BasicHttpBinding(), epa);
Yes, you can have an existing service exposed by 2 endpoints. Remember that WCF separates logic from the communication. The endpoint is that message contract. One service can be exposed in multiple ways.
Here at work, I always expose services in three bindings:
basicHttpBinding (for all the noobs still using ASP.NET 1.1)
webHttpBinding (This is to expose the service via a REST URL... because I prefer contract-first web service design, it's not just for fun)
wsHttpBinding (for the not-noobs)
-
Mar 13th, 2009, 01:38 PM
#5
Re: WCF: Callback and streaming
 Originally Posted by Hamish
Can I create a service class that implements 2 interfaces, one for each service contract?
I love to learn new things. 
As you probably know, I'm no WCF expert, but I am pretty sure thats possible and also quite easy. You would just create your 2 interfaces and then create your 2 classes that implement each of these interfaces. Then add an endpoint to your service host for each, in the same way that you would if you were just adding one endpoint.
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
|