Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET WCF
How one can get method details (method name + list of parameter names with their values) from OperationContext.Current in WCF 4.0 SOAP service?
 
I'm trying to implement my own generic diagnostics that can read all the method details from the current call context of the service.
 
Cheers!
Posted 14-Nov-12 2:14am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try my following CP article: LoggingBehavior - How to Connect Log-prints with the WCF Operation's Details, using a Simple Behavior[^]

If you put the LoggingBehavior attribute on your service, you should have those details in the LoggingContextDetails of the operation's current LoggingContext. The input values are in LoggingContext.Current.Details.Inputs and, you can get the method name and parameters from the MethodInfo that is provided in LoggingContext.Current.Details.MethodDetails.

  Permalink  
v3
Comments
Vitaly Tomilov at 14-Nov-12 9:07am
   
That's a long read. And even after going through it (I saw your article earlier), I'm not clear how do I get a list of inputs with values? Can you simplify and just answer my question here?
Shmuel Zang at 14-Nov-12 9:28am
   
See the updated solution.
Vitaly Tomilov at 15-Nov-12 8:51am
   
Thank you. It seemed a little overhead though. I had only 8 service methods that needed to report the list of parameters and values in them. In the end I settled for simply enumerating using keyword params, and then processing them in a generic way.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 14 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid