0XC0020016

RPC_NT_OUT_OF_RESOURCES (0XC0020016) – Why It Happens & The Fix

This error means the RPC service ran out of ephemeral ports or memory. It’s almost always port exhaustion. The quick fix: increase the ephemeral port range.

Quick answer: Run netsh int ipv4 show dynamicport tcp. If the start port is below 10000 and total ports below 16000, you’re looking at port exhaustion. Fix: netsh int ipv4 set dynamicport tcp start=10000 num=55535 and reboot.

This error – RPC_NT_OUT_OF_RESOURCES (0XC0020016) – pops up when an app or service tries to make an RPC call and the RPC service can't allocate the resources it needs. I’ve seen it most often on busy SQL servers, Exchange, or file servers that hammer RPC with concurrent connections. The culprit here is almost always ephemeral port exhaustion – the TCP/IP stack ran out of temporary ports for outgoing connections. But it can also be memory pressure inside the RPC subsystem, especially on 32-bit systems or servers with very high DCOM traffic.

Don’t bother rebooting first – that only masks the symptom until the ports fill up again. You need to widen the range.

Step 1: Check Current Ephemeral Port Range

netsh int ipv4 show dynamicport tcp

Look at the Start Port and Number of Ports values. Default on Windows Server 2012 and older is start=1025, num=3976. On Server 2016 and newer it’s often start=49152, num=16384. If you see a small range (like 4000 ports) or a low start port, that’s your problem.

Step 2: Increase the Port Range

netsh int ipv4 set dynamicport tcp start=10000 num=55535
netsh int ipv6 set dynamicport tcp start=10000 num=55535

This bumps the range to about 55,000 ports – more than enough for most environments. Do both IPv4 and IPv6 if you have IPv6 enabled (which you probably do).

Step 3: Reboot the Server

Yes, you have to reboot. The RPC service caches the old port range, and it won’t pick up the new one until the TCP/IP stack reinitializes. No way around it.

Verify the Change

netsh int ipv4 show dynamicport tcp

You should see start=10000 num=55535. Then check the Application and System logs for any more 0XC0020016 errors.

If That Doesn’t Fix It – Alternate Fixes

Still seeing the error? Here’s what else to check:

  • Memory pressure on the RPC service: Open Task Manager, go to Details, find svchost.exe -k RPCSS. If its Private Bytes are over 1GB on a 64-bit system (or 300MB on 32-bit), you’ve got a memory leak. Restart the RPC service (yes, it’s safe – remote admin will drop temporarily). Running sc stop RpcSs && sc start RpcSs from an elevated command prompt works.
  • DCOM timeouts: If the error comes from a specific app (like a backup agent or management tool), check DCOM settings. Run dcomcnfg, expand Component Services > Computers > My Computer, right-click Properties, go to Default Properties. Set Authentication Level to Connect and Impersonation Level to Impersonate. Also increase the RPC Port Range on the Default Protocols tab by adding ports 5000-6000 to the TCP/IP protocol.
  • Antivirus interference: Some AV software intercepts RPC traffic. Temporarily disable it and reproduce the error. If it stops, add RPC-related exclusions.
  • Registry tweak (advanced): If you can’t reboot, you can try increasing RPC worker threads via registry:
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc]
    "MaxRpcSize"=dword:00000400
    But honestly, this rarely helps in practice – port range is the real fix.

Prevention Tip

Don’t wait for the error to hit again. On every new server build, set the ephemeral port range during initial configuration. I make it part of our standard image script. Also monitor TCP port usage with netstat -an | find /c ":80" or a proper monitoring tool (like PerfMon counter TCPv4/Connection Failures). The moment you see port usage above 80% of the range, expand it preemptively.

One last thing – if this error appears on a domain controller, check for LDAP traffic overwhelming RPC. That’s a separate issue, but the port fix still helps.

Related Errors in Server & Cloud
WindowsBootManagementFailed (or generic Boot failure with 0xC0000001) Azure VM won't boot: missing disk encryption key in Key Vault Hosting Panel Login Page Shows Blank White Screen 0X0000051F Fix ERROR_NO_LOGON_SERVERS 0x51f in Windows 0XC0020001 0XC0020001: Fix RPC_NT_INVALID_STRING_BINDING Error

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.