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 :
Microsoft Dynamics CRM (Archived)

Unable to connect to Dynamics 365 CRM online with my asp.net C# application.

(0) ShareShare
ReportReport
Posted on by 80

Hi All,

I am trying to connect with my online CRM through a C# application but unable to connect through the following code. 

ClientCredentials credentials = new ClientCredentials();
credentials.UserName.UserName = "testUser";
credentials.UserName.Password = "abcd@123";
Uri serviceUri = new Uri("orgname/.../Organization.svc");
OrganizationServiceProxy proxy = new OrganizationServiceProxy(serviceUri, null, credentials, null);

I am getting error in the last line. 

"An exception of type 'System.InvalidOperationException' occurred in Microsoft.Xrm.Sdk.dll but was not handled in user code

Additional information: Metadata contains a reference that cannot be resolved: 'orgname/.../Organization.svc'.

"

Any Help???

*This post is locked for comments

I have the same question (0)
  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Unable to connect to Dynamics 365 CRM online with my asp.net C# application.

    Hello,

    You should try using Xrm Tooling for connection purposes - msdn.microsoft.com/.../jj602970.aspx

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Unable to connect to Dynamics 365 CRM online with my asp.net C# application.

    Try the latest CRM SDK? (version 8.2)

  • SCV Profile Picture
    1,004 on at
    RE: Unable to connect to Dynamics 365 CRM online with my asp.net C# application.

    Hi Fisal,

    Try to give the full username; like testuser@yourdomainname.onmicrosoft.com.

  • Verified answer
    faisal.malik84 Profile Picture
    80 on at
    RE: Unable to connect to Dynamics 365 CRM online with my asp.net C# application.

    Thanks ,

    I tried using  Xrm Tooling for connection purposes with latest SDK assemblies and that works.

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans