Friday, 6 June 2014

What WCF bindings to use with Windows Phone 8



If like me you are using .NET 4, you are limited in options for bindings you can use with Windows Phone 8 client. There are only 3 default bindings available and out of these NetHttpBinding is only available on .Net 4.5. Hence you are only left with basicHttpBinding and NetTcpBinding. If you are looking for reliable messaging and session support, NetTcpBinding is only one which ticks all the boxes.

To modify your basicHttpBinding to netTCPBinding, change the endpoint address to be net.tcp:// (instead of http://)

Moreover make sure that ".NET Features -> WCF Activation -> Non-HTTP activation" feature is installed ("server manager -> add/remove features"). If you are hosting on IIS, also check if net.tcp protocol is allowed for a web site(Web Site -> Advanced Settings -> Enabled Protocols) and "Net.Tcp Listener Adapter" windows service is running.