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.
Only one usage of each socket address (protocol/network address/port) is normally permitted.
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 App Service
Azure Static Web Apps
3 answers
Sort by: Most helpful
-
-
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 moreThe 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:
-
Fatih Bahceci 5 Reputation points
2025-01-07T22:31:38.19+00:00 - 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.
- 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.
- 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.
- 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 throughtaskkill
with the initial PID. However, by tracing the parent process and terminating its child processes (likeconhost.exe
), the issue can be resolved without restarting Windows.I hope this helps someone else facing a similar ghost process issue!