Only one usage of each socket address (protocol/network address/port) is normally permitted.

Devang 0 Reputation points
2023-10-26T14:16:44.06+00:00

I'm using .NET 6 Web API with COSMOSDB and

facing issue like Only one usage of each socket address (protocol/network address/port) is normally permitted. when requesting many more APIs calls

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,901 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Konrad W 15 Reputation points
    2024-10-03T11:53:12.76+00:00

    It is a complete disaster that people looking for help inevitably waste their time and money on reading such a useless and rubbish computer-generated pointless and misleading crap of text. Facts: 1. That error is thrown when you try to LISTEN on an endpoint, that is already acquired to listening by some other software running on local computer. It has nothing to do with suggested "too many requests". 2. That error started to occur on Windows 11 even if the above condition is not actually met. Why? I don't know. I'm searching for a correct answer, but to the moment had no luck and found only misleading AI - suggestion. Just close this useles portal. stackoverflow and others do their job much better.

    3 people found this answer helpful.
    0 comments No comments

  2. Q&A Assist
    2023-10-26T14:16:44.0866667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error message "Only one usage of each socket address (protocol/network address/port) is normally permitted" typically occurs when there are too many connections being made to a single endpoint. This can happen when there are too many requests being made to Azure Cosmos DB from your .NET 6 Web API. One solution is to increase the number of available ports on your machine. Another solution is to optimize your code to use fewer connections to Azure Cosmos DB. You can also consider using connection pooling to reuse existing connections instead of creating new ones for each request.


    References:

    1 person found this answer helpful.
    0 comments No comments

  3. Fatih Bahceci 5 Reputation points
    2025-01-07T22:31:38.19+00:00
    1. Identify the port in use and find the associated PID:
    netstat -ano | findstr :1041
    

    Output Example:

      TCP    0.0.0.0:1041           0.0.0.0:0              LISTENING       14392
    

    The PID in this case is 14392.


    1. Trace the parent process of the PID:
    wmic process get processid,parentprocessid | findstr/i 14392
    

    Output Example:

    14392            9584
    

    Here, 9584 is the parent process of 14392.


    1. Check for child processes under this parent process:
    wmic process where (ParentProcessId=9584) get Caption,ProcessId
    

    Output Example:

    Caption      ProcessId
    

    This revealed a conhost.exe process with PID 38776.


    1. Terminate the identified process:
    taskkill /f /pid 38776
    

    Output Example:

    SUCCESS: The process with PID 38776 has been terminated.
    

    After this, the port was released, and I could restart the application without rebooting the system.


    Key Insight:

    In some cases, the process occupying the port might not appear directly in tasklist or through taskkill with the initial PID. However, by tracing the parent process and terminating its child processes (like conhost.exe), the issue can be resolved without restarting Windows.

    I hope this helps someone else facing a similar ghost process issue!

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.