Search code examples
c#wcfhttpdata-exchange

Technique for sending data between a desktop client and a WCF service?


What is the best way of exchanging data between a C# desktop application and WCF service? The only method I know now is to send data as a string array with delimiters.

Thanks


Solution

  • What kind of data do you want to send to the WCF service, and can you alter both the client and the service?

    For binary data you could best use an net.tcp-binding, which is optimal for that kind of data and has the least overhead.

    If you simply need to send multiple variables in one call, you can decorate a class that contains properties for every variable you want to send with a data contract and send that object as a whole, without the need to use delimiters you use when all data is in one variable.