MaxRecursion
MaxRecursion

Reputation: 4893

How to write interceptor for WCF service

I have a WCF service with basicHttpBinding. I want to write interceptor for each method call in service to do some logging stuff. I want to add this interceptor for some fields methods only.

I am pretty new in WCF. Any help is appreciated.

Thanks.

Upvotes: 0

Views: 2036

Answers (1)

stuartd
stuartd

Reputation: 73253

You will want to implement IDispatchMessageInspector - you can get the invoked method by looking at the OperationContext and then you can decide whether you want to handle the method call.

You then have to implement the usual WCF plumbing, a ServiceBehavior and a BehaviorExtension, as in the doc page.

Upvotes: 1

Related Questions