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

  • Home
  • SEARCH
  • 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 7795949
In Process

The Archive Base Latest Questions

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

I’m working with two applications, one has a self hosted service configured to use

  • 0

I’m working with two applications, one has a self hosted service configured to use the net.tcp binding. The ServiceBehaviorAttribute of the service is configured with:

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple,
                 InstanceContextMode = InstanceContextMode.Single,
                 IncludeExceptionDetailInFaults = true,
                 UseSynchronizationContext = false,
                 ValidateMustUnderstand = false)]

For both, service and client the transferMode is set to Streamed, and the timeouts are:

closeTimeout="00:01:00"
openTimeout="00:00:30"
receiveTimeout="00:02:30"
sendTimeout="00:02:30"

MaxConnections is set to 500 and the ServiceThrottlingBehavior uses the WCF 4 default values:

  • MaxConcurrentSessions: 100 * ProcessorCount
  • MaxConcurrentCalls: 16 * ProcessorCount
  • MaxConcurrentInstances: default is the total of the above two, which follows the same pattern as before.

I’m using a quad-core machine and the Net.Tcp Port Sharing service is enabled.

The client application has a single channel to the service created using the ChannelFactory class. Once the channel is created 100 threads are spawned. Each thread uses the channel to send messages to the server with a frequency of one message per second.

After a couple of seconds running ok (the client sends messages to the server an it receives them correctly) an EndpointNotFoundException is thrown with the following message:

Could not connect to net.tcp://localhost/service. The connection attempt lasted 
for a time span of 00:00:02.1777100. TCP error code 10061: No connection could 
be made because the target machine actively refused it 127.0.0.1:808.

The weird things are:

  • If I run both applications in the same machine the time span of the exception is about 2 seconds, but if I run the server application in my machine and the client application in a different machine the time span of the exception is always 1 second.
  • Some times (like one in ten) the exception doesn’t throw and both applications works fine.
  • Before the exception is thrown the server receives messages and processes them correctly. No exceptions are thrown in the server.

I made a lot of tests, reducing the amount of threads, increasing it, changing the close, open, receive and send timeouts to lower and higher values, setting a higher value for maxConnections but the result is always the same, at some point the EndpointNotFoundException is thrown. I’m about to give up and change the code so each thread has its own channel hoping this fixes the issue, but I want to know why this happens. If someone knows what I’m doing wrong or can point me in the right direction to keep investigating it will be helpful.

  • 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-01T23:13:15+00:00Added an answer on June 1, 2026 at 11:13 pm

    By default Windows doesn’t enable port sharing. I would check that you have it properly enabled (see here).

    If possible, you could also try changing the port of one application, or do testing of one within a VM.

    Also, for anyone else that may have the same issue, do as Diego has done and check that port sharing is enabled in the configuration. Add portSharingEnabled="true" to the binding:

    <system.serviceModel>
      <bindings>
        <netTcpBinding name="portSharingBinding" 
                       portSharingEnabled="true" />
      <services>
        <service name="MyService">
            <endpoint address="net.tcp://localhost/MyService"
                      binding="netTcpBinding"
                      contract="IMyService"
                      bindingConfiguration="portSharingBinding" />
        </service>
      </services>
    </system.serviceModel>
    

    Taken from: http://msdn.microsoft.com/en-us/library/ms731810.aspx

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported

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.