Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 952645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:55:42+00:00 2026-05-15T23:55:42+00:00

This is on .Net 4, full framework. I’m trying to make a simple winforms

  • 0

This is on .Net 4, full framework.

I’m trying to make a simple winforms app that will make some simple WCF REST calls. It’s using ChannelFactory and the service contract interface. Of the ~20 methods in the interface, 2 of them involve Stream (an upload and a download method) so the service side (and currently also the client side) using TransferMode=Streamed.

My goal is to include the full HTTP request and response (much like you would see in ethereal/wireshark, or fiddler, or whatever), with headers, in a textbox of the winforms app (just to show what went over the wire)

In trying to use the built-in diagnostics (via SvcConfigEditor) and my own (via implementing IClientMessageInspector and then IEndpointBehavior to add the inspector, then channelFactory.Endpoint.Behaviors.Add to add the behavior :), I’m having 2 issues:

  1. When doing request.ToString() or reply.ToString() in BeforeSendRequest and AfterReceiveReply, it only gets the ‘body’ and not the headers. Digging around in the objects in the debugger it looks like the reply has them in reply.Properties[“httpResponse”], but the request’s request.Properties[“httpRequest”] has an empty Headers property even though Fiddler shows headers for Content-Type, Host, Accept-Encoding, and Connection. It seems like there’s likely a better way to get the ‘raw’ message that I’m missing (and if there’s not, someone probably knows an existing chunk of code to ‘reconstruct’ the raw one from the Message)
  2. Since the transfer mode is Streamed, the ‘body’ part just shows up as the string ‘… stream …’, both in SvcTraceViewer (and the ‘raw’ svclog – even with logEntireMessage=true) and when doing a ToString(). If the mode is Buffered instead, it shows the actual body fine. I tried making a copy with reply.CreateBufferedCopy(int.MaxValue); but that then caused the actual WCF call to fail with an InvalidOperationException: This message cannot support the operation because it has been copied.

One fallback would be to move the client to Buffered and just change to StreamedRequest for the one upload call and StreamedResponse for the download call (but I’d have to do that programmatically AFAICT, as it’s set at the binding level in the config and I don’t see anyway of doing it via attributes on the calls), which would take care of the ‘body’ part and leave me with just the “get the http request headers” (issue #1, specifically request.Properties[“httpRequest”].Headers being empty) to deal with, but I’m hoping there’s some way of logging the ‘raw’ messages without doing so, leaving the TransferMode as Streamed.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:55:43+00:00Added an answer on May 15, 2026 at 11:55 pm

    I can’t find any reference right now, but it’s a known fact that you cannot capture the contents of a streamed message to WCF tracing. When streaming is enabled, only the headers of the message will be traced.

    Here’s the source: Configuring Message Logging on MSDN

    See towards the end of the page:

    Service Level

    Messages logged at this layer are
    about to enter (on receiving) or leave
    (on sending) user code. If filters
    have been defined, only messages that
    match the filters are logged.
    Otherwise, all messages at the service
    level are logged. Infrastructure
    messages (transactions, peer channel,
    and security) are also logged at this
    level, except for Reliable Messaging
    messages. On streamed messages, only
    the headers are logged.
    In addition,
    secure messages are logged decrypted
    at this level.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm maintaining a Windows CE app built with the .NET Framework that has about
I am developing a C# (targeting full framework 4) windows app. I need that
The full .Net framework has an inherited UserControl but this option isn't offered by
This .NET API works OK if I'm trying to open the Registry in a
This is .NET 4.0/C#. I have a class that inherits from an interface: public
In this asp.net page, there is a link that leads to another page in
So I have this asp.net web application that I renamed. I changed the assembly
We're developing this ASP.NET web app with multiple users on different browsers. One of
So I have this ASP.Net 2.0 website that uses functions contained within a JS
The Microsoft .NET Framework 4.0 full installer (32- and 64-bit) is 48.1 MB and the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.