The chunking channel download includes two applications demonstrating use of the channel, a client application and a corresponding service application.
The applications work as expected with regard to the first operation defined by the contract:
[
ServiceContract]interface ITestService
{
[OperationContract]
[ChunkingBehavior(ChunkingAppliesTo.Both)] Stream EchoStream(Stream inboundStream);}
Switching to a message contract, however, results in an exception thrown because ChunkingWriter.CreateStartChunk() is never called, leaving the message header-less in a later call to ChunkingWriter.CreateChunkMessage(). The altered contracts:
[
MessageContract] public sealed class EchoRequestMessage{
[
MessageBody] public Stream stream;}
[
MessageContract] public sealed class EchoRequestResponseMessage{
[
MessageBody] public Stream stream;}
[ServiceContract] interface ITestService{
[
OperationContract][
ChunkingBehavior(ChunkingAppliesTo.Both)] EchoRequestResponseMessage EchoStream(EchoRequestMessage echoRequestMessage); Any assistance in understanding why this is the case and what to do about it would be greatly appreciated.John

Using Message Contracts With The Chunking Channel
m ghandour
Further information...
When creating the first chunk message using the original service contract, ChunkingWriter.WriteStartElement() is called twice: first with the operation name, 'EchoStream' and then with the parameter name, 'inboundStream'. Calls to ChunkingWriter.WriteBase64() then commence, sending chunk messages as they reach their capacity.
When creating the first chunk message using the message contracts, ChunkingWriter.WriteStartElement() is called only once, only with the parameter name 'inboundStream' and not with the operation name. Since the operation name member of the StartChunkState instance is still null, the parameter name becomes set as the operation name. Without a second call to WriteStartElement(), the parameter name with the StartChunkState instance remains null and ChunkingWriter.CreateStartChunk() is never called, leaving the chunk message without headers. Calls to ChunkingWriter.WriteBase64() then commence and the attempt to send the first chunk message throws an exception without them.
What causes two calls to WriteStartElement() in one case, but only one in the other is difficult to assess because the associated mechanism is part of the .NET Framework, not part of the chunking channel implementation.
Still very much in need of assistance!