Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

i'm getting the error-"Additional information: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail." when i try to retive info from an entity using console ap

Posted on by 85

An unhandled exception of type 'System.ServiceModel.Security.MessageSecurityException' occurred in Microsoft.Xrm.Sdk.dll

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

my code:

using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Client;
using Microsoft.Xrm.Sdk.Query;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.ServiceModel.Description;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplicationdate
{
class Program
{
static void Main(string[] args)
{
#region Org Connection
IOrganizationService organizationService = null;
ClientCredentials clientCredentials = new ClientCredentials();
//clientCredentials.UserName.UserName = ConfigurationManager.AppSettings["Username"].ToString();
//clientCredentials.UserName.Password = ConfigurationManager.AppSettings["Password"].ToString();

clientCredentials.UserName.UserName = "trail.onmicrosoft.com";
clientCredentials.UserName.Password = "password";
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;



// Copy and Paste Organization Service Endpoint Address URL
organizationService = new OrganizationServiceProxy(new Uri("org------.api.crm8.dynamics.com/.../Organization.svc"), null, clientCredentials, null);
#endregion

if (organizationService != null)
{
Console.WriteLine("sucess");
var query = new QueryExpression("crf1b_class")
{
ColumnSet = new ColumnSet("crf1b_name"),
Criteria = new FilterExpression(LogicalOperator.And),
TopCount = 50
};
//query.Criteria.AddCondition("address1_city", ConditionOperator.Equal, "Redmond");
//query.AddOrder("name", OrderType.Ascending);

EntityCollection results = organizationService.RetrieveMultiple(query);

results.Entities.ToList().ForEach(x =>
{
Console.WriteLine(x.Attributes["crf1b_name"]);
});
Console.ReadLine();
}


}
}
}

  • Suggested answer
    meelamri Profile Picture
    meelamri 13,204 User Group Leader on at
    RE: i'm getting the error-"Additional information: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail." when i try to retive info from an entity using consol

    Check this video: https://youtu.be/uht_7D5FHJ8

  • Manoj  Profile Picture
    Manoj 85 on at
    RE: i'm getting the error-"Additional information: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail." when i try to retive info from an entity using consol

    THANK YOU

  • Manoj  Profile Picture
    Manoj 85 on at
    RE: i'm getting the error-"Additional information: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail." when i try to retive info from an entity using consol

    No i don't know anything about Azure, how to connect with it.

  • Suggested answer
    meelamri Profile Picture
    meelamri 13,204 User Group Leader on at
    RE: i'm getting the error-"Additional information: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail." when i try to retive info from an entity using consol

    Hello,

    Did you disable multi-factor authentication and test your console application?

  • meelamri Profile Picture
    meelamri 13,204 User Group Leader on at
    RE: i'm getting the error-"Additional information: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail." when i try to retive info from an entity using consol

    Please, edit your initial post and delete your sensitive data such as your username and password

  • Suggested answer
    meelamri Profile Picture
    meelamri 13,204 User Group Leader on at
    RE: i'm getting the error-"Additional information: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail." when i try to retive info from an entity using consol

    Hello Manoj,

    I think you're using multi-factor authentication. If yes, disable it, and test your console application again.

    softchief.com/.../

  • Manoj  Profile Picture
    Manoj 85 on at
    RE: i'm getting the error-"Additional information: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail." when i try to retive info from an entity using consol

    is there any one to help me here?

    this is the line where i'm getting error

    organizationService.RetrieveMultiple(query);

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans