Solved

WCF Faulted Duplex Channel

Posted on 2013-06-20
5
1,751 Views
Last Modified: 2013-06-21
On my client I am using the DuplexChannelFactory to create a channel to communicate with a WCF service.

On the server I retrieve a callback channel for subsequent use.

Client side:

ICallback callBack = new CallBack();
NetTcpBinding netTcpBinding = new NetTcpBinding(SecurityMode.None); //testing only

DuplexChannelFactory<IService> cf = new DuplexChannelFactory<IService>(callBack,
netTcpBinding,
new EndpointAddress("net.tcp://x.x.x.x:8080/Service"));

channel = cf.CreateChannel();

Open in new window


Server side:

return OperationContext.Current.GetCallbackChannel<ICallback>();

Open in new window


I need to be able to callback from the server over a long period (approx 4 hours).
If I dispose of the channel on the client side can I still use the callback channel on the server side i.e. does the callback channel use/reference the originating client side channel in some way?

Thanks
0
Comment
Question by:odubhgaill
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 500 total points
ID: 39265101
Uhmm,  the answer is yes, your server will register an entry to communicate with your client, thus client program must keep the channel reference for the callback to work properly, other wise the server does not know how to contact your client program.

I used the sample shown on the link below to build a system before as it gives me more visibility of connecting/disconnecting clients:
http://www.devx.com/dotnet/Article/38814
0
 

Author Comment

by:odubhgaill
ID: 39266435
Thanks... thats one of the best articles I've seen on the subject.

I'm confused because on my client the channel is getting disposed once I have registered with the service but the service continues to callback to the client -

Client side:

DuplexChannelFactory<IService> cf = new DuplexChannelFactory<IOcms>(
                                    callBack,
                                    new NetTcpBinding(),
                                    new EndpointAddress("net.tcp://x.x.x.x:8081/Service"));
IService proxy = cf.CreateChannel();

proxy.RegisterService(param1, param2);
                

Open in new window


In the RegisterService method on the server I get a reference to callback object which the service continues to use long after the client object has been disposed.

return OperationContext.Current.GetCallbackChannel<ISomeInterface>();

Open in new window


Any ideas how the service is still able to call back? This looks to suggest that the callback channel is completely seperate from the channel used by the client?
0
 
LVL 36

Expert Comment

by:Miguel Oz
ID: 39267218
Uhmm, by "execute callback"  do you mean code is still executing code on the client side.
You can still have the callback object defined on the server but without a client to target is doing nothing and must be removed.
0
 

Author Comment

by:odubhgaill
ID: 39267299
The client is still running so the server can callback but the object the client used to connect to the server has been disposed. I thought that the channel the client used to connect to the server was in someway bound with the callback channel the server uses. Maybe that's not the case....
0
 
LVL 36

Expert Comment

by:Miguel Oz
ID: 39267486
Correct it is not the case, you are better off managing the channel lifetime yourself.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question