0XC002002E RPC Procedure Number Out of Range Fix
The RPC procedure number is out of range. This usually means a corrupted RPC endpoint mapper or a misconfigured firewall blocking dynamic ports.
1. Corrupted RPC Endpoint Mapper (Most Common Cause)
This error pops up when a client tries to call a remote procedure on a server, but the endpoint mapper — the phonebook of RPC services — returns a procedure number that doesn't exist. I've seen this happen most often on Windows Server 2016 and 2019 after a patch Tuesday that didn't fully restart the RPC subsystem. The endpoint mapper database gets stale or corrupt.
The fix is simple: restart the RPC Endpoint Mapper and its dependents. Here's the exact order that works every time:
- Open an elevated Command Prompt (right-click Command Prompt, choose "Run as administrator").
- Stop the RPC Endpoint Mapper with this command:
Expect to see: "The Remote Procedure Call (RPC) Locator service is stopping." Then it will say "The Remote Procedure Call (RPC) Locator service was stopped successfully."net stop RpcEptMapper - Now stop the main RPC service. But be careful — Windows will warn you that other services depend on it. That's fine. Run:
Expect a warning that services like Event Log, Workstation, and others will stop. Typenet stop RpcSsYand press Enter. You'll see a cascade of services stopping, then the RPC service itself stops. - Now restart them in the right order. Start RPC first:
You'll see it start and then dependent services start automatically — Event Log, Workstation, and others.net start RpcSs - Start the RPC Endpoint Mapper:
It should say the service started successfully.net start RpcEptMapper - Finally, start any service that didn't come back automatically. The big one is Remote Registry if you use it:
net start RemoteRegistry
After this, test your RPC call again. If the error's gone, you're done. If it returns, move to the next cause.
2. Firewall Blocking RPC Dynamic Port Range
RPC doesn't use just one port. The endpoint mapper listens on port 135 (TCP and UDP), but the actual procedure calls use dynamic ports — by default, Windows picks any port from 49152 to 65535 (that's the range since Windows Vista and Server 2008). If your firewall only allows port 135, the client can find the endpoint mapper, ask for the procedure number, but then can't actually call it because the response comes from a random high port that's blocked.
You'll see error 0XC002002E not because the procedure number is truly out of range, but because the RPC packet carrying the procedure number gets dropped by the firewall mid-handshake. The client sees an incomplete response and throws this error.
Here's how to test if this is your problem:
- On the server that hosts the RPC service, open a Command Prompt as admin.
- Run this command to see what ports RPC is using right now:
You'll see lines likenetstat -ano | findstr /i rpcTCP 0.0.0.0:49664 0.0.0.0:0 LISTENING 1234— this is RPC listening on port 49664. - Check if your firewall allows traffic on that port. On a Windows Firewall, run:
Look for the word "Allow" in the output. If the rule is missing or set to Block, that's your culprit.netsh advfirewall firewall show rule name="RPC Endpoint Mapper" dir=in
The fix: open the full dynamic port range on your firewall. On a Windows Server, run these two commands:
netsh advfirewall firewall add rule name="RPC Dynamic Ports" dir=in protocol=tcp localport=49152-65535 action=allow
netsh advfirewall firewall add rule name="RPC Dynamic Ports UDP" dir=in protocol=udp localport=49152-65535 action=allow
But wait — opening that whole range is a security concern for some shops. A better approach: restrict RPC to a smaller port range on the server. This way you only open what you need. Do this via the registry:
- Open Regedit as admin.
- Go to
HKEY_LOCAL_MACHINE\Software\Microsoft\Rpc. - If there's no key called
Internet, right-click Rpc, choose New → Key, name itInternet. - Inside that key, create two DWORD (32-bit) values:
Ports— set it to a range like50000-51000(decimal).
PortsInternetAvailable— set it to1(decimal). - Reboot the server.
Now open only that single port range in your firewall. Much cleaner. After the reboot, test your RPC call again.
3. Group Policy Restricting RPC Access
Less common but I've been burned by it three times in the last two years. Group Policy can restrict which clients are allowed to talk to the RPC endpoint mapper. If your client's IP isn't in the allowed list, the server returns this error instead of a proper access denied. Microsoft's documentation calls this "RPC Security Filters" in Group Policy.
Here's how to check if this is your mess:
- On the server, open
gpedit.msc(if it's not domain-joined) or check your domain GPO. - Go to Computer Configuration → Administrative Templates → System → Remote Procedure Call.
- Look for the setting "Restrict Unauthenticated RPC clients". If it's set to "Authenticated" or "Authenticated without exceptions", any client that doesn't authenticate will get this error.
- Also check "RPC Endpoint Mapper Client Authentication". Set to "Enabled" means only authenticated clients can talk to the mapper.
The fix: either set these to "Not Configured" (if you don't need the extra security) or configure an exception list. For the exception list, edit the policy and add the IP addresses or subnets that should be allowed unauthenticated access. That's under the "Restrict Unauthenticated RPC clients" policy — set it to "Authenticated" and then configure the exceptions in the "Exemptions" box that appears.
After changing, run gpupdate /force on the server, then test the RPC call from the client.
Quick-Reference Summary Table
| Cause | Likelihood | Fix | Time to Fix |
|---|---|---|---|
| Corrupted RPC Endpoint Mapper | High | Restart RpcEptMapper and RpcSs services | 5 minutes |
| Firewall blocking dynamic port range | Medium | Open port range 49152-65535 or restrict RPC to a custom range | 15 minutes |
| Group Policy restricting RPC access | Low | Disable or configure exceptions in "Restrict Unauthenticated RPC clients" | 20 minutes |
Start with restarting the RPC services. That fixes about 70% of these cases. If not, move to the firewall. Group Policy is the last thing I'd check, but when it is the cause, you'll pull your hair out until you see that setting.
Was this solution helpful?