Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

At least one security token in the message could not be validated. I got this error message when I tried to connect to CRM online through my Dot Net web portal.

(0) ShareShare
ReportReport
Posted on by 10

"At least one security token in the message could not be validated". I got this error message when I tried to connect to CRM online thru my Dotnet web portal.

It worked very well till 8 hours, I got "At least one security token in the message could not be validated" error message when Dotnet was trying to authenticate and connect to CRM online.

Reset IIS is a quick an easy fix. However it is really annoying every time you have to reset IIS manually.

Error Message :An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.

Exception Type:  System.ServiceModel.Security.MessageSecurityException

Inner Exception: System.ServiceModel.FaultException: At least one security token in the message could not be validated.

I am using Below CRM Dll version

Microsoft.Xrm.Sdk   9.0

Microsoft.Crm.Sdk.Proxy.dll 9.0

Microsoft.Xrm.Tooling.Connector : 2.0

CRM Online Stack Trace:

 Server stack trace:      at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)     at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)     at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)     at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)    Exception rethrown at [0]:      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)     at Microsoft.Xrm.Sdk.IOrganizationService.Execute(OrganizationRequest request)     at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request)     at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.Execute(OrganizationRequest request)     at Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request)     at Microsoft.Xrm.Sdk.Linq.QueryProvider.RetrieveEntityCollection(OrganizationRequest request, NavigationSource source)     at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups, String& pagingCookie, Boolean& moreRecords)     at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups)     at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](Expression expression)     at Microsoft.Xrm.Sdk.Linq.QueryProvider.GetEnumerator[TElement](Expression expression)     at Microsoft.Xrm.Sdk.Linq.Query`1.GetEnumerator()     at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)     at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)     at Gprint.Web.Controllers.amazonController.sellerRankTrackingReport(JObject jo)     at lambda_method(Closure , Object , Object[] )     at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters)     at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)     at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.<ExecuteAsync>b__4()     at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)

Please Help

  • Nitu Shah Profile Picture
    Nitu Shah 10 on at
    RE: At least one security token in the message could not be validated. I got this error message when I tried to connect to CRM online through my Dot Net web portal.

    public class TestExceptionFilter : ExceptionFilterAttribute

    {

    public override void OnException(HttpActionExecutedContext context)

    {

    try

    {

    if (context.Exception is System.ServiceModel.Security.MessageSecurityException)

    {

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

    TestLabs.Crm.Configuration.ServerConfiguration sc = new TestLabs.Crm.Configuration.ServerConfiguration()

    {

    UserName = ConfigurationManager.AppSettings["crmusername"].ToString(),

    Password = ConfigurationManager.AppSettings["crmpassword"].ToString(),

    OrganizationServiceURL = ConfigurationManager.AppSettings["crmorganizationserviceurl"].ToString(),

    };

    TestLabs.Crm.Repository.CrmConnection.Connect(sc);

    }

    catch(Exception ex)

    {

    throw;

    }

    }

    }}

  • AKV Profile Picture
    AKV 10 on at
    RE: At least one security token in the message could not be validated. I got this error message when I tried to connect to CRM online through my Dot Net web portal.

    Thanks a lot for the prompt response..

    Will it be possible to share the exception handling code you applied for this issue

  • Nitu Shah Profile Picture
    Nitu Shah 10 on at
    RE: At least one security token in the message could not be validated. I got this error message when I tried to connect to CRM online through my Dot Net web portal.

    Hello,

    I found the solution. Issue in CRM connection when i upgrade CRM version

    Check your CRM dll version (Microsoft.Xrm.Sdk   9.0)

    After the dll version changes It disconnect CRM connection every 24 hours. so i handle the exception  and reconnect CRM connection when this issue occurred.

  • AKV Profile Picture
    AKV 10 on at
    RE: At least one security token in the message could not be validated. I got this error message when I tried to connect to CRM online through my Dot Net web portal.

    I'm facing the exact same issue. Did you manage to find a resolution?

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans