Occassionally we get the following error when we call the OrganizationService web service from an custom exernal application:
"System.ServiceModel.Security.MessageSecurityException: Security processor was unable to find a security header in the message."
The custom application is a WCF service that runs on the the same machine where CRM server is installed.
We are using Dynamics 365 On-Premise, 8.2.0.749.
Most of the time the calls of the OrganizationService work fine.
We access the OrganizationService by using OrganizationServiceProxy:
IServiceConfiguration<IOrganizationService> infoOrganization = ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>( new Uri(ci.OrganizationServiceUrl));
ChannelFactory<IOrganizationService> channelFactory = infoOrganization.CreateChannelFactory(ClientAuthenticationType.Kerberos); service = new OrganizationServiceProxy(infoOrganization, channelFactory.Credentials);
Besides that we find a lot of other MessageSecurityExceptions in the CRM trace that where not caused by our application:
<TraceRecord xmlns="schemas.microsoft.com/.../TraceRecord" Severity="Error"><TraceIdentifier>msdn.microsoft.com/.../System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>
<Description>Eine Ausnahme wird ausgelöst.</Description>
<AppDomain>/LM/W3SVC/1/ROOT-1-131383916618071720</AppDomain>
<Exception><ExceptionType>System.ServiceModel.Security.MessageSecurityException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>Fehler bei der Nachrichtensicherheitsüberprüfung.</Message><StackTrace> bei System.ServiceModel.Security.MessageSecurityProtocol.VerifyIncomingMessage(Message&amp; message, TimeSpan timeout, SecurityProtocolCorrelationState[] correlationStates)
</StackTrace><ExceptionString>System.ServiceModel.Security.MessageSecurityException: Fehler bei der Nachrichtensicherheitsüberprüfung. ---&gt; System.ServiceModel.Security.Tokens.SecurityContextTokenValidationException: Das SecurityContextSecurityToken mit "context-id=urn:uuid:6a1143a1-733d-4636-abf0-8c52ff2400e5" ("key generation-id=") ist nicht registriert.>
Any idea?
*This post is locked for comments