Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

MessageSecurityException when calling the OrganizationService

Posted on by 5

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&lt;/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;amp; message, TimeSpan timeout, SecurityProtocolCorrelationState[] correlationStates)
</StackTrace><ExceptionString>System.ServiceModel.Security.MessageSecurityException: Fehler bei der Nachrichtensicherheitsüberprüfung. ---&amp;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

  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: MessageSecurityException when calling the OrganizationService

    Hi Maho,

    i would suggest you to take a look on the below , this is very WCF generic error:

    1.Check the binding between the server and client are same.

    2.Check that you need to enable SSL and assign a certificate in IIS.

    icoder.wordpress.com/.../how-to-setup-a-wcf-service-using-basic-http-bindings-with-ssl-transport-level-security

    3.Check whether a mismatch between security settings on client and server.

    stackoverflow.com/.../unable-to-debug-wcf-service-message  

    4.This is usually happens because the message is sending a timestamp to Web log server and the response is coming with no timestamp, try turning off the timestamp in the security.

    http://blog.latamhub.com/?p=78

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans