1

I have a WCF web service running under IIS with WebHttpBinding. It talks JSON. A sample method looks like this:

public OrderResponse Save(OrderRequest request) ...

So I am assuming that ASP.NET converts the JSON message into the OrderRequest object on the fly when it comes in.

I would like to save the incoming JSON message into a file. I thought that WCF tracing was the answer. I implemented the winning answer to the WCF Tracing question.

I added the following to my web.config to enable message logging.

<system.serviceModel>
   <diagnostics>
      <messageLogging 
              logEntireMessage="true" 
              logMalformedMessages="false"
              logMessagesAtServiceLevel="true" 
              logMessagesAtTransportLevel="false"
              maxMessagesToLog="3000"
              maxSizeOfMessageToLog="2000"/>
   </diagnostics>
 </system.serviceModel>

So I do get the WCF trace file but it doesn't seem to contain the actual message despite logEntireMessage="true".

What am I missing?

Community
  • 1
  • 1
AngryHacker
  • 59,598
  • 102
  • 325
  • 594
  • Take a look at [this](http://blogs.msdn.com/b/rodneyviana/archive/2014/02/06/logging-incoming-requests-and-responses-in-an-asp-net-or-wcf-application-in-compatibility-mode.aspx) if it is helpful to you. This approach only works with WCF because they are enabling compatibility mode. The code was implemented in Global.asax which is the default Http Module for an ASP.NET application, but it can be used in a HttpModule that is maintained separately. – Avijit Dec 23 '14 at 18:33
  • did you look at this ? http://stackoverflow.com/questions/14513490/how-can-i-view-parameters-and-json-objects-via-wcf-traces-for-https-rest-web-ser – indolentdeveloper Dec 23 '14 at 18:43

0 Answers0