An existing connection was forcibly closed by the remote host

... can be caused by the fact that your WCF service cannot receive more connections at the moment. As a default, a WCF service can receive 10 concurrent (session based) requests. If you are writing an internal WCF service (intranet, not internet) that has more than 10 constant consumers (consumers-with-a-session), you need to configure it accordingly: In system.serviceModel, add:
    <behaviors>
      <serviceBehaviors>
        <behavior name="ThrottleBehavior">
          <serviceThrottling maxConcurrentCalls="6"
             maxConcurrentInstances="200"
             maxConcurrentSessions="200"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
... where maxConcurrentInstances/maxConcurrentSessions are the expected number of clients and maxConcurrentCalls are clients/100. On your service, add the attribute: behaviorConfiguration="ThrottleBehavior" I hope this saves you 6 hours+ google time. Thank you, Cameron Hanchey

Comments

Popular posts from this blog

Auto Mapper and Record Types - will they blend?

Unit testing your Azure functions - part 2: Queues and Blobs

Testing WCF services with user credentials and binary endpoints