I get this error when calling a WCF service from an ASP.Net application:
Unhandled Exception: System.InvalidOperationException
System.InvalidOperationException: The entry found in AuthenticationManager CustomTargetNameDictionary for {URL} does not match the requested identity of host/{Hostname}.
Server stack trace:
at System.ServiceModel.Channels.HttpTransportSecurityHelpers.AddIdentityMapping(Uri via, EndpointAddress target)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.PrepareOpen()
at System.ServiceModel.Channels.HttpsChannelFactory.HttpsRequestChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
The strange part of this is that I cannot play it on any machine other than our web servers, and this only happens occasionally. The service requires active directory authentication, but I'm sure the user has the correct set of permissions.
This does not seem to be a problem with the WCF configuration, because it sometimes works, while other applications make calls to the same service without errors.
I have already tried to completely recreate the user, recreating the application pool in which he runs and reinstalling the application. Thanks for the help!