Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

getting an error while calling the method.

Posted on by

Hello All Experts,

I am getting below error while calling the code .

"An error occurred when verifying security for the message.";

Below is my code .

EntityCollection ec = new EntityCollection();
IOrganizationService org=null;

org = new OrganizationServiceClient();
((System.ServiceModel.ClientBase<ConsoleApplication1.MDDev02NS.IOrganizationService>)org).ClientCredentials.UserName.Password = "*****";
((System.ServiceModel.ClientBase<ConsoleApplication1.MDDev02NS.IOrganizationService>)org).ClientCredentials.UserName.UserName = "pqr";

QueryExpression qe = new QueryExpression();
qe.EntityName = "account";
qe.ColumnSet = new ColumnSet() { AllColumns = true };

ec=org.RetrieveMultiple(qe); // Error at this line...

can anyone help me resolving this.

*This post is locked for comments

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: getting an error while calling the method.

    It seems like you are missing the endpoint:

    string strURI = @"http://CRMServerName:defaultPort/&quot; + strOrg + "/XRMServices/2011/Organization.svc";

    System.ServiceModel.EndpointAddress epa= new System.ServiceModel.EndpointAddress(new Uri(strURI), System.ServiceModel.EndpointIdentity.CreateDnsIdentity(""));

    org.Endpoint.Address= epa;

    See the following article for more information:

    social.technet.microsoft.com/.../12209.crm-2011-how-to-use-organizationserviceclient-with-pure-wcf-call-no-xrm-dll.aspx

    Hope this helps.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: getting an error while calling the method.

    Hello,

    Please find following links --

    - community.dynamics.com/.../dynamics-crm-2011-quot-an-error-occurred-when-verifying-security-for-the-message-quot

    - community.dynamics.com/.../145481

    Hope this helps!

    [If you find any helpful answer(s) of your question, please mark the answer(s) as verified answer(s).]

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