<p>Would using WSDualHttpBinding for duplex callbacks work in real-world scenarios?  Say, I have a .NET application that uses a random port, would the service be able to resolve the client's base addresses and port for callbacks?</p>

[{'answer_id': 59777, 'author': 't3rse', 'author_id': 64, 'author_profile': 'https://Stackoverflow.com/users/64', 'pm_score': 2, 'selected': False, 'text': '<p>If it\'s an application behind a firewall, theoretically yes. It depends on what you mean by "real world"; if by that you mean "high performance" perhaps NetTcpBinding is a better appraoch.</p>\n'}, {'answer_id': 1248492, 'author': 'Peter McG', 'author_id': 57465, 'author_profile': 'https://Stackoverflow.com/users/57465', 'pm_score': 6, 'selected': True, 'text': '<p>A complete answer to your question depends on the "real-world scenario" being either an Intranet or an Internet scenario.  Although WSDualHttpBinding works in both scenarios there are specifics to be aware of:</p>\n\n<p><strong>Intranet</strong></p>\n\n<p>WSDualHttpBinding will work with your .NET application using a preconfigured custom port in an Intranet scenario and "Yes" the service will be able to resolve the client\'s base addresses and port for callbacks: exactly how is explained below.  The reason it\'s explained below is that WSDualHttpBinding is primarily designed to be used over the Internet.</p>\n\n<p>Duplex callbacks in an Intranet scenario when you can use WCF on both client and server is best achieved by using NetTcpBinding or NetNamedPipeBinding.  These bindings use TCP and ICP respectively as transport (rather than HTTP) and a custom binary encoding which is why WCF is required on both sides.  For calls-back to the client the same channel used to connect to the Service via the Binding is re-used without requiring a new port to be opened.</p>\n\n<p><strong>Internet</strong></p>\n\n<p>In an Internet scenario valid HTTP requests and responses only travel in one direction, HTTP is designed as a one-way protocol.  When using the WSDualHttpBinding WCF therefore creates a seperate HTTP channel for callbacks.  In answer to your second question: the destination address for this call-back to the client is composed of the client machine hostname and port 80 by default.  If the client is a development machine for example and has IIS installed, port 80 will be exclusively reserved in some scenarios which will cause conflicts with your prototype application.  This is what <a href="http://blogs.msdn.com/wenlong/archive/2006/10/19/how-to-use-wsdualhttpbinding-on-windows-xp-for-hosted-services.aspx" rel="noreferrer">this blog post</a> presents a solution for and what the ClientBaseAddress property is designed to help with.  Regardless of which port you go with - the default or a custom one, you must ensure all firewalls and routers on both sides are configured correctly to allow both the outgoing channel and the seperate callback channel to be established.</p>\n\n<p>A .NET application can also denote a Silverlight application.  Because of the fact that a Silverlight application running in a browser cannot accept new incoming HTTP connections, WSDualHttpBinding with it\'s seperate back channel will not work.  Hence PollingDuplexHttpBinding was created firstly in Silverlight 2 which can be thought of as a clever \'trick\' to get around the fact that HTTP is unidirectional by keeping the request channel open for a long time (long polling) and using it as a back channel for calls back to the client.  This has a number of implications on both the client and server side particularly relevant to scaling, for more detail please see <a href="http://petermcg.wordpress.com/2008/09/03/silverlight-polling-duplex-part-1-architecture/" rel="noreferrer">this post from my blog</a>.</p>\n\n<p>With an idea of your particular "real-world scenario" and your use-cases hopefully this will help you work out the correct binding to use for duplex callbacks.</p>\n'}]
['https://Stackoverflow.com/questions/59677', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5563/']