I have a WCF Service with HTTP bindings which returns dataset on 500k size.
When using WCF default logging I can see the messages and data being transfered with each message
<system.serviceModel>
<!-- add trace logging -->
<diagnostics wmiProviderEnabled="true">
<messageLogging
logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true"
maxMessagesToLog="3000"
/>
</diagnostics>
....
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add initializeData="c:\nettcpTestLOCALToTEST.xml" type="System.Diagnostics.XmlWriterTraceListener"
name="messages">
<filter type="" />
</add>
</listeners>
</source>
</sources>
</system.diagnostics>
Point is, I am looking for a way to reduce the traffic between server and client, and I have been told that NetTCP is transferring the data binary? Is that correct?
I have set up a test scenario with a NetTCPBinding and when I read the WCF on the client side, the Response Message includes the whole dataset schema and data in XML format. Is it just serialized so the can be written to a log, or was this message transfered binary?
Is the amount of data being transfered with a NetTCP binding smaller than with HTTPBinding? Is it text or binary?
thanks in advance
yes the message will be transfered binary but the Serializer (Datacontractserializer I assume) will serialize the data in XML format:
DataContractSerializer
From the docu:
NetTcpBinding MSDN
If you opt to implement ISerializable you can use WCF too but you have to implement an DataContractResolver to resolve the types: if the client “knows” the Types (for example you put them into a dll and add them to the client-app) you can use the following example-code (sorry I only have this in F# around but you should find it easy to translate)
This should yield the serialization in more compact form.
PS: found the same in C#:
(Please note: stackoverflow don’t like the assignmentoperator “<-” from F# and i don’t know how to circumvent – therefore I used “=”)
oh well – I guess I have to say how to add those resolvers to your host:
use this with:
replacing “MyServiceMethod” by the name of your service-method (on call per method or you iterate over all of them)