tags:

views:

272

answers:

1

I am new to WCF services. I have been working with WCF for over two months now and love its capabilities. I am using a self hosted WCF in a Windows Service. The binding is netTCP because the client and service are on the same machine. My communication is duplex and I am using a WCF session. With these features, one of the design needs for my application is that UI should always be connected to the service - I am using a separate thread in my UI to always poll the connection status and re-create and open the channel in case it goes to faulted state. Since I have async call backs from the service, the client should always be connected. Here are a couple of questions:

  1. Is it OK to use self host technique knowing that the client and service on the same machine? I used WCF for ease of inter process communication.

  2. Does it make sense to keep this keep alive thread from the client or should I be using some other technique?

I want to get better in using and configuring WCF. is there a good book or online reading material on self hosted WCF services?

Please advice.

Thanks,

Subbu

+1  A: 

I think it's absolutely fine to use self-hosting with WCF. I've implemented many services that are hosted in a Windows Service for example. I'm assuming that you're talking about client and server being hosted in different processes on the same machine? If so, then ideally you should use binary over named pipes in your bindings.

If client and server and physically in the same process, then you might consider using something like Roman Kiss's Null Transport to reduce the serialization overhead. His CodeProject article can be found here: http://www.codeproject.com/KB/WCF/NullTransportForWCF.aspx

To answer point 2, I've suggested an alternative approach in my answer to another Stackover question: http://stackoverflow.com/questions/3049515/wcf-net-tcp-server-disconnects-how-to-handle-properly-on-client-side/3053481#3053481

Hope this helps.

Tim Roberts
Yes, the wcf service and client are on two separate processes. Since both processes talk to each other, I have hosted a WCF service in each and use wcf clients on both sides due to the need for async communications. I am using net tcp binding. Sometimes, I am getting an exception from the wcf client saying "Connection to server aborted.....timeout 2:59:999....." and when i check the state of the client, its actual in an opened state. How is this possible?Does the net tcp binding have something to do with this?
Subbu

related questions