I am writing a WCF service requires impersonate and session.
It is ok when I tried to call it on my local machine, but on the remote machine it always failed with s
There is also a dirty hack, as posted here, here, and here, and analysed here.
You can supply a dummy Service Principal Name (SPN). In that case, WCF will not fail, but fall back to NTLM for authentication which doesn't verify the principal.
So, configuration:
and programmatically
EndpointIdentity identity = EndpointIdentity.CreateSpnIdentity("dummy");
using ChannelFactory:
Uri uri = new Uri("net.tcp://:/myServiceAddress");
ChannelFactory channelFactory = new ChannelFactory(new NetTcpBinding());
channelFactory.CreateChannel(new EndpointAddress(uri, identity)
will also work.