0XC0020001: Fix RPC_NT_INVALID_STRING_BINDING Error
This error means an RPC client passed a malformed string binding to the server. Happens with bad endpoint syntax or mismatched protocol sequences.
When This Error Hits
You'll see RPC_NT_INVALID_STRING_BINDING (0XC0020001) when an RPC client tries to bind to a server using a string binding that the RPC runtime can't parse. This pops up in a few specific places:
- Custom apps or services calling
RpcBindingFromStringBindingwith a badly formatted string. - DCOM configuration where the endpoint or protocol sequence is mangled in the registry.
- WMI queries failing, or Exchange/ SQL Server roles that rely on RPC and have corrupted config files.
One common real-world scenario: a sysadmin runs a PowerShell script that builds an RPC string binding dynamically, but the endpoint port is missing a colon, or the protocol sequence uses an unsupported value. The RPC runtime immediately returns 0xC0020001 — it won't even try to connect.
Root Cause
The RPC string binding format is strict. It looks like this:
obj_uuid@protocol_sequence:network_address[endpoint]
The parts break down as:
- obj_uuid — optional, a GUID that identifies the object on the server.
- protocol_sequence — required, one of the supported strings like
ncacn_ip_tcp,ncacn_np,ncalrpc. - network_address — required for TCP/IP, the hostname or IP.
- endpoint — optional if the server uses dynamic endpoints, or required for static ones. For TCP, it's a
[port_number]in brackets. For named pipes, it's[\pipe\pipename].
The error fires when the RPC runtime tries to decode this string and hits a syntax violation. The reason it's a separate error from RPC_S_INVALID_STRING_BINDING (which is a client-side validation) is that 0XC0020001 is an NTSTATUS variant — the server-side RPC runtime throws it when a client's binding string doesn't pass the server's parser. In practice, most people hit it on the client side during binding setup, not after a connection is established.
The Fix
-
Validate the protocol sequence. Only use:
ncacn_ip_tcpfor TCP/IP,ncacn_npfor named pipes,ncacn_spxfor SPX (legacy),ncalrpcfor local RPC. Misspell any, likencacn_tcpinstead ofncacn_ip_tcp, and you'll trigger the error.
Example of a valid binding:
ncacn_ip_tcp:192.168.1.50[135] -
Check the endpoint syntax. For TCP, the endpoint must be in brackets and be a number. For named pipes, the endpoint starts with
\pipe\inside the brackets. A missing bracket or a port with letters fails immediately.
Wrong:ncacn_ip_tcp:10.0.0.1[abc]
Right:ncacn_ip_tcp:10.0.0.1[135] -
Don't forget the colon after the protocol sequence. The format is
protocol_sequence:then the address. If you writencacn_ip_tcp10.0.0.1[135](no colon), the parser can't split the parts.
The reason step 3 works is that the RPC runtime uses a simplestrchr-style scan for:to delimit the protocol sequence. If there's no colon, it never finds the boundary and treats the whole string as the sequence, which is invalid. -
If the error comes from a DCOM application, open Component Services (dcomcnfg.exe), navigate to the specific component, and check its Endpoints tab. Make sure the protocol sequence and endpoint are correct. If you see
ncacn_ip_tcpwith a port of0, that's dynamic — that's fine. If it's blank or has garbage, that's your problem.
Registry path for DCOM entries:HKCR\AppID\{app-guid}andHKCR\CLSID\{clsid}\AppID. -
If the error is from a custom app that builds the string binding, add debugging output to print the exact string being passed to
RpcBindingFromStringBinding. Then manually inspect it for extra spaces, missing brackets, or wrong case on protocol sequences. Protocol sequences are case-sensitive? The RPC runtime treats them as case-insensitive on Windows, but I've seen old Exchange servers choke on uppercase. Stick to lowercase to avoid surprises. -
Verify that the object UUID (if used) is a valid GUID in the format
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. If you put a UUID that's missing a dash or has a bad character, the runtime can't parse it and returns this error. The UUID part is separated by@from the rest of the string.
Still Failing? Check These
- Look at event logs — Windows logs
RPCevents under Applications and Services Logs > Microsoft > Windows > RPC. The source isMicrosoft-Windows-RPC. Event ID 1 or 2 might show the malformed string. - Test with a known-good binding — use a tool like
rpcdump.exefrom the Windows SDK to test a simplencacn_ip_tcp:127.0.0.1[135]connection. If that works, the issue is in your app's string construction, not the RPC stack. - Check for null or empty strings — if your code passes an empty string to
RpcBindingFromStringBinding, you get this error. I've seen scripts that read a binding from a config file and the value is whitespace-only. Trim input before using it. - If using named pipes, make sure the pipe name exists — the endpoint
\pipe\pipenamemust match exactly what the server registered. Even a single character mismatch gives this error because the binding string is valid syntactically but the server rejects it — wait, no. The parser validates syntax, not existence. If the syntax is correct but the pipe doesn't exist, you getRPC_S_SERVER_UNAVAILABLE(1722), not this error. So don't chase that rabbit.
Was this solution helpful?