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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:05:01+00:00 2026-05-26T21:05:01+00:00

System Description: I have a WCF service (self hosted in a windows service) which

  • 0

System Description: I have a WCF service (self hosted in a windows service) which is consumed by a client (also a windows service). The two applications are designed to have constant uptime. The ‘queue’ application reads entries from a database, sends ‘jobs’ to the WCF service for processing which returns some information to the client, and the client stores the results back into the DB.

Error Details: After around two hours the client application can no longer connect to the WCF service reporting the error:

“Insufficient winsock resources available to complete socket connection initiation.”,

A second application which runs on the same server also starts throwing exceptions from this time onwards:

“A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)”

The second application is nothing to do with the WCF client and server, it just runs on the same server and simply reads/writes to a database.

Server/Client setup/code:

Server Details:

  • Self hosted inside a windows service.
  • netTcpBinding
  • receiveTimeout=”00:00:15″
  • serviceThrottling maxConcurrentCalls=”2147483647″
  • maxConcurrentSessions=”2147483647″

Client Connection Class::

public class ClientConnectionClass : ClientBase<IFileService>, IFileService, IDisposable
{

    public void callMethod(InputRequest request)
    {
        result = base.Channel.doRequest(request);
    }

    void Dispose()
    {
        bool success = false;
        try
        {
            if (State != CommunicationState.Faulted)
            {
                Close();
                success = true;
            }
        }
        finally
        {
            if (!success)
            {
                Abort();
            }
        }
    }
 }

Client Process (windows service):

while(true)
{
    // Do some stuff before, code ommited
    ClientConnectionClass ccc = new ClientConnectionClass();
    ccc.callMethod(inputRequest);
    // Do some stuff with the response
    // Close the connection class, is this the right way to close it?
    ccc.Close();
    Thread.Sleep(1000);
}

Possible Explanations:
I think that based on the first exception error, the code is not closing/releasing socket connections or running out of ports to connect on (please note I am explicitly calling the Close() method of the ClientBase from the ClientProcess, in addition to implementing the Dispose() method on the ClientBase).

Notes: Client application is multi-threaded, has up to 4 concurrent threads running at the same time, each of which calls the WCF service. The client to WCF service is fully working up until the 2 hour (ish) point where the Client Process then spits out errors, and other (unrelated) Windows Services (which use network resources) also start to spit out errors.

Possible Questions to answer: Am I creating/disposing of the Class that implements the ClientBase class? Is there any easier way to debug/log the current state of either the Client or WCF service ( I have attached perfmon.exe, but it doesn’t really give much useful information on the socket/network side of things ).

Thanks

UPDATE: I have actually now wrapped the ClientConnectionClass into a ‘using’ statement, I am currently testing this ( which usually takes 2 hours ). Update, this did not work.

  • 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-05-26T21:05:01+00:00Added an answer on May 26, 2026 at 9:05 pm

    What platform are you running? Win2k3, Win2k8? I have seen unsubstantiated reports on the web of applications experiencing similar issues running on pre-Win2k8 systems that “resolve” running on Win2k8. Also, if the client and server are running on the same system, is it possible to use a namedpipe binding vs. nettcp? Not really a fix but may workaround your particular issue.

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

Sidebar

Related Questions

I have a self-hosted WCF service that is hosted by a desktop application. I
I have a simple self hosted WCF Console windows app, and I can connect
I have a WCF in VB which is to be hosted in a Windows
I have a WCF Service Library containing five service contracts. The library is hosted
I have WCF RESTful service and Android client. Server replies with 400 when I
I have Windows Server 2008 R2 with IIS7 on it. I deployed WCF service
I have created a WCF web service in C# deployed in a Windows Service
I have a WCF service using BasicHttpBinding with Windows authentication. Most clients are domain
I have made a description system, but all which doesn't work is my search
System.Environment.OSVersion does not appear to indicate which Edition of Windows 2003 is installed (Standard,

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.