Mar 02, 2012 10:16 PM|fedak|LINK
Ok let me step back a step- here is what I'm trying to do. We have a 3 tier application architecture were the self hosted middle tier exposes a WCF/TCP service to the WinForm client and we are currently exploring exposing a REST service for access by external
We had started development using WCF for the REST interface but are now exploring the new WinAPI.
All of our logging is done via a static utility class. This class currently has a fair amount of logic to detect the context of where it is being called from. If the logging routine is called from within one of our service calls (i.e. OperationContext.Current
!= null) we can pull out information such as the client user, which operation is being processed, and some custom information from the WCF message header that we place into the OC extension)
Thus the user of the log routine doesn't need to worry about this and we get this context with each log entry.
This looks relatively straightforward to do from a pure web/asp context where I would have the HttpContext available.
I don't see any way to do this from WebApi. So specifically I'm hoping to be able to determine the following w/o having to change the interface of my logging library:
1) The ability to detect that I'm in a WebApi call
2) The authenticated user/client IP of the originater of the request
3) Custom payloads that refer back to the context of the request