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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:21:48+00:00 2026-06-13T23:21:48+00:00

I am using a ChannelFactory to communicate with external services by sending raw soap

  • 0

I am using a ChannelFactory to communicate with external services by sending raw soap requests. I have a NetTcp endpoint that uses the IDuplexSessionChannel. I tried creating a IRequestChannel/IRequestSessionChannel using binding.BuildChannelFactory<T>(), but that did not work (threw exception). From what I read online, duplex channels can be used like request channels, where you call a service method and get an immediate response. I want to know if the below code accomplishes that. I searched everywhere to see an example of ChannelFactory and IDuplexSessionChannel, but could not find anything. Lastly, if this were an IDuplexChannel instead of an IDuplexSessionChannel, would the implementation be any different since one is sessionful and the other isn’t?

IChannelFactory factory;
IChannel        channel;

Binding         binding = GetBindingFromConfig( bindingName );
EndpointAddress address = new EndpointAddress( endpointAddress );

if( binding.CanBuildChannelFactory<IDuplexSessionChannel>() )
{
    factory = binding.BuildChannelFactory<IDuplexSessionChannel>();
    factory.Open();
    channel = ( (IChannelFactory<IDuplexSessionChannel>)factory ).CreateChannel( address );
    channel.Open();

    ( (IDuplexSessionChannel)channel ).Send( requestMessage );
    ( (IDuplexSessionChannel)channel ).TryReceive( Timespan.MaxValue, out responseMessage );
}

Here is my configuration file:

<netTcpBinding>
    <binding
        name="xyz"
        closeTimeout="00:01:00"
        openTimeout="00:01:00"
        receiveTimeout="00:10:00"
        sendTimeout="00:01:00"
        transactionFlow="false"
        transferMode="Buffered"
        transactionProtocol="OleTransactions"
        hostNameComparisonMode="StrongWildcard"
        listenBacklog="10"
        maxBufferPoolSize="524288"
        maxBufferSize="10485760"
        maxConnections="10"
        maxReceivedMessageSize="10485760">

        <readerQuotas
            maxDepth="32"
            maxStringContentLength="8192"
            maxArrayLength="10485760"
            maxBytesPerRead="4096"
            maxNameTableCharCount="16384" />

        <reliableSession
            ordered="true"
            inactivityTimeout="00:10:00"
            enabled="false" />

        <security mode="Transport" />
    </binding>
</netTcpBinding>
  • 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-13T23:21:49+00:00Added an answer on June 13, 2026 at 11:21 pm

    I found a way to fix the issue, here it is:

    ChannelFactory<IRequestChannel> factory;
    IRequestChannel                 channel;
    
    Binding         binding = GetBindingFromConfig( bindingName );
    EndpointAddress address = new EndpointAddress( endpointAddress );
    
    factory = new ChannelFactory<IRequestChannel>( binding, address );
    
    // Since this endpoint uses sessions, we have to allow sessions to prevent an exception.
    factory.Endpoint.Contract.SessionMode = SessionMode.Allowed;
    
    factory.Open();
    channel = factory.CreateChannel( address );
    channel.Open();
    
    responseMessage = channel.Request( requestMessage );
    

    Credits: http://blogs.msdn.com/b/drnick/archive/2007/06/25/changing-the-channelfactory-contract.aspx

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

Sidebar

Related Questions

I have a windows service that uses WCF to connect to other services. It
I have a project that is a WCF client using netTCP endpoints. The project
Short Version: When I've created a Channel using ChannelFactory on a client which uses
i have using WCF service in my code that the client(WindowsFormsApplication1) capturing desktop view
I have a client that connects to a WCF service using a netTcpBinding .
I have the following code var factory = new ChannelFactory<INewsClient>(); factory.Credentials.ClientCertificate.Certificate = GetCertificate(); factory.Endpoint.Address
I am using a ChannelFactory with netTcpBinding. Sometimes I get exceptions and after these
I have a WCF service that needs to know the Principal of the calling
I have a number of WCF services on my internal network which are hosted
I'm building a series of WCF Services that are going to be used by

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.