Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8403879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:27:10+00:00 2026-06-09T22:27:10+00:00

When I host my wcf service via webiste iis7, the method AfterReceiveRequest does not

  • 0

When I host my wcf service via webiste iis7, the method AfterReceiveRequest does not get called.

Please help..

Thanks

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<String>(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
}

My Behavior Extension class, Service.svc, and config settings are as follows:

<system.serviceModel>
    <services>
      <service name="C:\Visual Studio 2010\WebSites\WCFService8">
        <endpoint binding="netTcpBinding" bindingConfiguration="" behaviorConfiguration="Default" contract="CultureServer.IHelloWorld" />
      </service>
    </services>
    <behaviors>

      <endpointBehaviors>
        <behavior name="Default">
          <CultureExtension/>
        </behavior>
      </endpointBehaviors>

      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <extensions>
      <behaviorExtensions>
        <add name="CultureExtension" type="Extension.CultureBehaviorExtension, Extension, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
      </behaviorExtensions>
    </extensions>

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>


public class CultureBehaviorExtension : BehaviorExtensionElement
{
    // BehaviorExtensionElement members
    public override Type BehaviorType
    {
        get { return typeof(CultureBehaviour); }
    }

    protected override object CreateBehavior()
    {
        return new CultureBehaviour();
    }
}


<%@ ServiceHost Language="C#" Debug="true" Service="CultureServer.Server"%>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T22:27:11+00:00Added an answer on June 9, 2026 at 10:27 pm
    <services> 
      <service name="C:\Visual Studio 2010\WebSites\WCFService8"> 
        <endpoint binding="netTcpBinding" bindingConfiguration="" behaviorConfiguration="Default" contract="CultureServer.IHelloWorld" /> 
      </service> 
    </services> 
    

    The name attribute for the <service> tag is wrong. It should have the class name, not a path. Try replacing it with the code below.

    <services> 
      <service name="CultureServer.Server"> 
        <endpoint binding="netTcpBinding" bindingConfiguration="" behaviorConfiguration="Default" contract="CultureServer.IHelloWorld" /> 
      </service> 
    </services> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to host wcf service application with Plesk Panel 9.2 in
I know with .NET we can host wcf service from a console application without
I host my WCF Service with windows service hosting... now when I call my
I want to host a WCF service with TCP Protocol. I can host the
I'm trying to host my WCF service in a windows service host. For managing
For some testing code, I'd like to be able to host a WCF service
I have a WCF service. I am trying to host the service in a
I am trying to publish a WCF service that sends to a NSB host.
I am attempting to create and host a simple RESTful WCF Service. The service
Hello my console app is my host for my wcf restful service which I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.