Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

CrmServiceClient(connectionstring) issue with Home Realm Uri

Posted on by Microsoft Employee
Hi, my project is using the CrmServiceClient class from Microsoft.Xrm.Tooling.Connector. The way I'm using it (by requirement) is with connection string (e.g. CrmServiceClient("AuthType=AD;Url=http://contoso:8080/Test; Domain=CONTOSO; Username=jsmith; Password=passcode")).

I'm currently able to connect to CRM Online, On-Premise, etc. with this method except when I need to set the Home Realm Uri parameter. There is an On-Premise CRM 365 which requires Home Realm Uri to retrieve the connection, when I put the rest of the parameters and the HomeRealmUri in it I'm unable to connect (with the message from CrmServiceClient.LastCrmError being "Unable to login to Dynamics Crm").

I tested using other method to see if I had incorrect information but this approach actually worked to connect to the same CRM successfully:

OrganizationServiceProxy service = new OrganizationServiceProxy(new Uri("https://contoso.crm.dynamics.com/XRMServices/2011/Organization.svc"), new Uri("https://server-1.server.com/adfs/services/trust/mex"), credentials, null);

My current connection string looks like this:

Server=https://contoso.crm.dynamics.com/contoso;Domain=contoso;UserName=contoso\\admin;Password=passcode;HomeRealmUri=server-1.server.com/.../mex;AuthType=IFD

I've tried different sets of parameters (removing the domain from username, adding ports to the server uri, changing auth type to AD, etc.) to no avail. I've searched a lot in the web too but haven't been able to find any information about a successful connection using homerealmuri with connection string apart from Microsoft documentation.

I'd like to know if somebody has a suggestion on what could be wrong in this situation or if at least someone has worked with home realm uri with CrmClientService(connectionstring) to give me some sense of direction.


Thanks,

*This post is locked for comments

  • mppowe Profile Picture
    mppowe 70 on at
    RE: CrmServiceClient(connectionstring) issue with Home Realm Uri

    I'm having the exact same issue.  Were you ever able to get this work? 

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans