Skip to main content

Notifications

Announcements

No record found.

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

  • Verified answer
    faisal.malik84 Profile Picture
    faisal.malik84 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.

  • SCV Profile Picture
    SCV 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
    Community Member Profile Picture
    Community Member Microsoft Employee 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)

  • Verified answer
    a33ik Profile Picture
    a33ik 84,325 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

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans