"The caller was not authenticated by the service" exception when calling WCF service?
I have a web app that calls a WCF service.
The problem is that for some of the users I get an exception ofThe caller was not authenticated by the service
while for others it works. I cannot figure out why there is a difference. I want to add that I use windows authentication.
The code I have is:
binding = new WSHttpBinding(SecurityMode.Message);
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
binding.Security.Message.NegotiateServiceCredential = true;
binding.Security.Message.EstablishSecurityContext = false;
// create the channel factory for the service proxy
factory = new ChannelFactory<开发者_如何学C;IWCF>(
binding,
new EndpointAddress(
new Uri(
CriptographyService.Decrypt(
ConfigurationSettings.AppSettings["WCF"]
)
),
EndpointIdentity.CreateUpnIdentity(
CriptographyService.Decrypt(
ConfigurationSettings.AppSettings["Identity"]
)
)
)
);
factory.Credentials.Windows.AllowedImpersonationLevel =
TokenImpersonationLevel.Delegation;
// create a channel to the service
return factory.CreateChannel();
精彩评论