web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

CRM connection failure from C# applicatin

(0) ShareShare
ReportReport
Posted on by

I am unable to connect to dyamics crm. I was using the same code like 8 months ago and it was working perfectly fine but now it is not working anymore.
I have created a sample application. I have creted an organization on dynamics crm trial and I am using the same same credentials to connect from my C# console application and I am getting the exception "An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail." and inner exception is "Authentication Failure".

I have also tried to sync the time zone but

Here is my code

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                ClientCredentials credentials = new ClientCredentials();
                credentials.UserName.UserName = "xyz@myorg.co";
                credentials.UserName.Password = "PasswordXYZ";
                string url = "">myorg3.api.crm11.dynamics.com/.../Organization.svc";
                
                var organizationUri = new Uri(url);
                
                var organizationService = (IOrganizationService)new OrganizationServiceProxy(organizationUri, null, credentials, null);
                
                if (organizationService != null)
                {
                    var resp = organizationService.Execute(new WhoAmIRequest()) as WhoAmIResponse;
                    if (resp != null)
                    {
                        //return resp;
                    }
                }

On organizationService.Execute(new WhoAmIRequest()) as WhoAmIResponse it throws exception.

I have the same question (0)
  • Suggested answer
    Mohamed Sanuj Basheer Profile Picture
    540 on at
    RE: CRM connection failure from C# applicatin

    Hello Partner,

    I tried to validate your code with my test instance and code works perfectly fine

    Suggestion 1:

    Validate the Organization service URL  on code and on crm are same. To validate got to settings > Customization > Developer resource 

    Also validate the credentials are correct.

    Suggestion 2:

    It can also be a possiblity due to your system settings(Time) – system time might be ahead of the server time. which means the request was going to server with a future time.
    So change the time in system clock which will get align to your org region example if your Org is crm8 then its india so align your systme time with IST and validate.

    Please find the geo list below

    https://docs.microsoft.com/en-us/power-platform/admin/geo-to-geo-migrations

  • arunav3690 Profile Picture
    5 on at
    RE: CRM connection failure from C# applicatin

    Hi,

    Is this issue resolved? Could you please provide the solution?

  • Allen Sha Profile Picture
    10 on at
    RE: CRM connection failure from C# applicatin

    Hi,

    Can you share the solution you found for this issue?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 247

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 166 Super User 2025 Season 2

#3
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 164

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans