Transferring large payloads of data (Serialized Objects) using wsHttp in WCF with message security

前端 未结 5 1210
陌清茗
陌清茗 2020-12-08 01:34

I have a case where I need to transfer large amounts of serialized object graphs (via NetDataContractSerializer) using WCF using wsHttp. I\'m using message security and woul

5条回答
  •  孤城傲影
    2020-12-08 01:55

    Some lighter, but not guaranteed solutions, would be to

    • use the DataContractSerializer instead since you own both sides. This does not require embedded type information, which is significantly large.
    • use [DataMember(EmitDefaultValue = false)] which is discussed in a question I asked - again because you own both sides; doing so will cut down some on the message size (how much depends of course on how many fields in the graph are defaults).
    • use [DataContract(IsReference=true)], especially if you have many repeated value objects or reference data
    • use some sort of throttling on the server to reduce memory pressure of simultaneous results

    These are, of course trade-offs, for example with readability.

提交回复
热议问题