Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

WCF Faulted Duplex Channel

Posted on 2013-06-20
5
Medium Priority
?
1,918 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 2000 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

636 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