Posts Tagged ‘wcf’

WCF Console Client Streamed

No Comments »

I spent the greater part of Monday morning troubleshooting a problem with a C#/WCF testing console application.  The service under test is a rather straight forward service that can be used to request data from my client’s database.  Because data can take a bit to prepare, we have it set up to get data as a job, basically request data gets you a job token and then some point in the future use the job token to download your data.

Seems that running the client proxy in a console app with transfermode set to streamed only lets me run a request 2x before it times out.  No issue if I run it buffered.  Google was not my friend … except for a few clues about memory and stream objects.

Thinking this may be a LOH issue or a resource that is not properly disposed of,  I took a look through the code for IDisposableness.  Found the innerChannel has a Disposable, so after closing my connection,  I call Disposable and then GC.Collect.  This “fixes” it – however I don’t know why the problem occurs (more of an instinct than knowledge) and I don’t know why what I did fixed it specifically and what are the side effects.  So I’ll be spending some time to understand it.  Not a fan of black magic and silver bullets.