WCF configuration issues: slow connection, netTcpBinding and Transport security give SSPI error
- Dominant language
- C#
- Stars
- 1.8k
- Forks
- 576
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 2
Description
I'm still struggling with the configuration of my WCF services and clients - perhaps someone can shed some light on the topic?
While porting a few services from .NET Remoting to WCF, I noticed several quirks, which I wasn't able to explain:
1. When using `localhost` in the service endpoint address, connection attempts work very fast (a few ms).
Using the explicit hostname (fully qualified or not) or `127.0.0.1` or `0.0.0.0` slows down each connection attempt dramatically, to about 500ms for every single connection. I couldn't find the reason for this discrepancy.
2. Using netTcpBinding with Transport security, everything works in every configuration I've tried when server and client are running on the same machine.
If the server is running on a different machine (in the same Windows Domain), I get an SSPI error when I use the server machine's **name** in the client endpoint address, but not if I use the server machine's **IP address**.
If I add `` to the client endpoint config, connection works, but I don't understand why this setting is required if both machines are part of exactly this domain?
If I add `` instead, it also works, completely independent of which value I give as SPN. Even an empty value works! But if I remove the node altogether, the SSPI error reappears.
I've even asked ChatGPT what the default value for the SPN is and the reply was `net.tcp/hostname_or_FQDN:port/service_name`, which sounded reasonable.
Using this SPN does work, but every other string I tried worked as well, so I cannot understand the claim that this SPN is somehow validated by AD/Kerberos/whatever.
I've been testing this with a small example, running both the server and the client under my user account.
Environment: Windows 10 Client, Windows 11 Server, .NET Framework 4.8.1.
Does anyone of the gurus have an explanation for this and some guidance what the best approach is?
Thanks
Martin
Contributor guide
Assessment
This issue has not been assessed yet.