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 8628837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:39:21+00:00 2026-06-12T08:39:21+00:00

Following code adds ParameterInspector to the endpoint. ChannelFactory<ITest> factory = new ChannelFactory<ITest>(BasicHttpBinding_ITest); OperationProfilerManager clientProfilerManager

  • 0

Following code adds ParameterInspector to the endpoint.

ChannelFactory<ITest> factory = new ChannelFactory<ITest>("BasicHttpBinding_ITest");
OperationProfilerManager clientProfilerManager = new OperationProfilerManager();
factory.Endpoint.Behaviors.Add(new OperationProfilerEndpointBehavior(clientProfilerManager));
ITest proxy = factory.CreateChannel();

As a good practice, We are attempting to move all this code to Web.config. So that merely creating factory like this

ChannelFactory<ITest> factory = new ChannelFactory<ITest>("BasicHttpBinding_ITest");

or this –

ChannelFactory<ITest> factory = new ChannelFactory<ITest>();

should fetch the extension elements from configuration. With following configurations, BeforeCall or AfterCall methods of IParameterInspector is not being triggered. Can you please point out our mistake in following Web.config –

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_ITest" />
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://n1:8000/Service" binding="basicHttpBinding"
            bindingConfiguration="BasicHttpBinding_ITest" contract="ServiceReference1.ITest"
            name="BasicHttpBinding_ITest" />
    </client>
    <behaviors>
        <endpointBehaviors>
            <behavior name="todo">                
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <extensions>
        <behaviorExtensions>
            <add name="OperationProfilerEndpointBehavior" type="SelfHostedServiceClient.OperationProfilerEndpointBehavior, SelfHostedServiceClient"/>
        </behaviorExtensions>
    </extensions>
</system.serviceModel>

Thank you for your help.

Reference: Carlos blog

EDIT: Resolution

Based on Carlos answer, I took following steps to resolve the issue.

Step 1. Created OperationProfilerBehaviorElement class derived from BehaviorExtensionElement. This class is responsible for instantiating the class implementing IEndpointBehavior

class OperationProfilerBehaviorElement : BehaviorExtensionElement  {
    public override Type BehaviorType
    {
        get {
            return typeof(OperationProfilerEndpointBehavior);
        }
    }

    protected override object CreateBehavior()
    {
        OperationProfilerManager clientProfilerManager = new OperationProfilerManager();
        return new OperationProfilerEndpointBehavior(clientProfilerManager);
    } }

Step 2. This class had to be declared in Web.config as below,

<extensions>
  <behaviorExtensions>
    <add name="OperationProfilerBehavior" type="SelfHostedServiceClient.OperationProfilerBehaviorElement, SelfHostedServiceClient"/>
  </behaviorExtensions>
</extensions>

Step 3. Added Endpoint behavior as below,

<behaviors>
  <endpointBehaviors>
    <behavior name="**InspectParameters**">
      <OperationProfilerBehavior/>
    </behavior>
  </endpointBehaviors>
</behaviors>

Step 4. Set behaviorConfiguration attribute of the endpoint equal to InspectParameters as below,

  <endpoint address="http://localhost:8000/Service" behaviorConfiguration="InspectParameters"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITest"
    contract="ServiceReference1.ITest" name="BasicHttpBinding_ITest" />

Now I was able to initialize factory in a single C# line and parameter inspector was added by default from Web.config

ChannelFactory factory = new ChannelFactory(“BasicHttpBinding_ITest”);

  • 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-12T08:39:22+00:00Added an answer on June 12, 2026 at 8:39 am

    The type OperationProfilerEndpointBehavior which is referenced in the <extensions> / <behaviorExtensions> section of the config should not be a class implementing IEndpointBehavior – it should be a type which inherits from BehaviorElementExtension, and that class is the one which should create the behavior.

    See more information about behavior extensions at http://blogs.msdn.com/b/carlosfigueira/archive/2011/06/28/wcf-extensibility-behavior-configuration-extensions.aspx.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have the following code: import argparse parser = argparse.ArgumentParser(description='Adds a new modem
I have built the following code with the Firefox add-on SDK that successfully adds
I have Grid View and Following Code In javascript to add new row. Problem
The following jQuery code adds an event by calling a function scroll_position jQuery.event.add(window, scroll,
The following code adds a checkbox and a label to the calling node. My
I have the following code, which should adds a field to a form if
Is it true that following code adds a XSS vulnerability to some JSP page?
I have the following code that adds a record to my MySQL database via
I have the following code which adds some arrays to a hashmap but then
The following code adds tasks that perform some processing on files from the blobstore,

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.