tags:

views:

38

answers:

1

I have a WCF 4.0 REST service Application that I would like to intercept an incoming request and check a custom header. In my solution I am using the following default endpoint

<standardEndpoints>
 <webHttpEndpoint>
        <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
 </webHttpEndpoint>
</standardEndpoints>

I have tried creating a IDispatchMessageInspector and corresponding BehaviorExtensionElement and adding the appropriate behaviorExtension and endPointBehavior to my web.config. What else do I have to do to make the interceptor fire?

I am assuming that my complete lack of knowledge on the real workings of WCF is killing me here. My IParameterInspector were easy to implement and works perfectly. I hoped this would be as easy to implement.

A: 

Follow up:


Since my goal of the RequestInterceptor was focused on authentication, I was able to achieve my desired result using a class derived from ServiceAuthorizationManager and added to web.config as follows.

 <behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- This behavior enables Auth Token Verification -->
      <serviceAuthorization serviceAuthorizationManagerType="Something.Service.Authorization, Something.Service" />
      <serviceMetadata httpGetEnabled="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
Joel Neubeck