title: put a breakpoint at ApplyDispatchBehavior method while wcf service hosted in iis7
body: <p>My wcf service is being hosted in iis7. Is there a way I could put break point at  ApplyDispatchBehavior method and make sure that its being called at run time by hitting that breakpoint?? My overall problem is that method AfterReceiveRequest is not being hit in the CultureMessageInspector class. Details of my code have been posted under questions in the following links. Please help me.. thanks</p>
  
  <p><a href="https://stackoverflow.com/questions/11997119/wcf-afterreceiverequest-not-getting-called">wcf AfterReceiveRequest not getting called</a></p>
  
  <p><a href="https://stackoverflow.com/questions/11994697/passing-culture-value-inside-wcf-service-hosted-by-iis">passing culture value inside wcf service hosted by iis</a></p>
  
  <pre><code>public class CultureBehaviour : IEndpointBehavior
      {
          #region IEndpointBehavior Members
  
          public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
          {
          }
  
          public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
          {
              CultureMessageInspector inspector = new CultureMessageInspector();
              clientRuntime.MessageInspectors.Add(inspector);
          }
  
          public void ApplyDispatchBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher)
          {
              CultureMessageInspector inspector = new CultureMessageInspector();
              endpointDispatcher.DispatchRuntime.MessageInspectors.Add(inspector);
          }
  
          public void Validate(ServiceEndpoint endpoint)
          {
          }
  
          #endregion
      }
  
  public class CultureMessageInspector : IClientMessageInspector, IDispatchMessageInspector
      {
          private const string HeaderKey = "culture";
          #region IDispatchMessageInspector Members
  
          public object AfterReceiveRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel, System.ServiceModel.InstanceContext instanceContext)
          {
              int headerIndex = request.Headers.FindHeader(HeaderKey, string.Empty);
              if (headerIndex != -1)
              {
                  Thread.CurrentThread.CurrentCulture = new CultureInfo(request.Headers.GetHeader&lt;String&gt;(headerIndex));
              }
              return null;
          }
  
          public void BeforeSendReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
          {
          }
  
          #endregion
  
          #region IClientMessageInspector Members
  
          public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
          {
          }
  
          public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
          {
              request.Headers.Add(MessageHeader.CreateHeader(HeaderKey, string.Empty, Thread.CurrentThread.CurrentCulture.Name));
              return null;
          }
  
          #endregion
      }
  </code></pre>