Hi All,
Could you please help me to resolve the below issue?
I am getting SOAP Negotiation Exception in Organization Service call when using DefaultNetworkCredentials. But if i am using the Username and Password, it works fine. Exactly in "WhoAmIResponse response = (WhoAmIResponse)_service.Execute(new WhoAmIRequest());" from the code snippet.
Code:
-----
Uri organizationUriIFD = new Uri("Organization URL");
ClientCredentials credentials = new ClientCredentials();
credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
IServiceConfiguration<IOrganizationService> config = ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(organizationUriIFD);
using (Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy _serviceProxy = new OrganizationServiceProxy(config, credentials))
{
_serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
IOrganizationService _service = (IOrganizationService)_serviceProxy;
OrganizationServiceContext orgContext = new OrganizationServiceContext(_serviceProxy);
WhoAmIResponse response = (WhoAmIResponse)_service.Execute(new WhoAmIRequest());
return _service;
}
Exception:
----------
SOAP security negotiation with 'https://...../adfs/services/trust/13/kerberosmixed' for target 'https://.../adfs/services/trust/13/kerberosmixed' failed. See inner exception for more details. ---> System.IdentityModel.Tokens.SecurityTokenValidationException:
The NetworkCredentials provided were unable to create a Kerberos credential, see inner exception for details. ---> System.IdentityModel.Tokens.SecurityTokenException: InitializeSecurityContent failed. Ensure the service principal name is correct. --->
System.ComponentModel.Win32Exception: No authority could be contacted for authentication
Thanks in advance.
--Siva