Skip to main content
Post a question

Notifications

Community site session details

Community site session details

Session Id : xAagpJgyZ35ji8bVqv7TwJ
Microsoft Dynamics CRM (Archived)

Cannot connect to on-premise CRM using CrmServiceClient

Like (0) ShareShare
ReportReport
Posted on 28 Nov 2018 20:48:17 by 59

Hi Members,

Can someone advise what I am missing in my code here in C#. But unable to connect to CRM. I am currently trying to configure this connectivity in my local environment.

string userName = "domain1\\user1";
string password = "test123";
string orgName = "hypernation.crm365.com/.../Organization.svc";
string internalurl = "hypernation.crm365.com";
NetworkCredential creds = new NetworkCredential(userName, CrmServiceClient.MakeSecureString(password));
Microsoft.Xrm.Tooling.Connector.AuthenticationType authType = Microsoft.Xrm.Tooling.Connector.AuthenticationType.AD;

CrmServiceClient conn = new CrmServiceClient(creds, authType, internalurl, "443", orgName, true, true, null);

I tried using connection string but no luck at all.

<add name="crm"
connectionString="AuthType=AD;Url=hypernation.crm365.com/.../Organization.svc; Domain=domain1; Username=domain1\user1; Password=test123;"/>

Here above is there any other alternative to configure connection string?
My main motive is to use the flag "RequireNewInstance=true". but can't seem to use it without CrmServiceClient instance.

I am able to connect to CRM using OrganizationServiceProxy class and can access entities fluently.

Thank you.

*This post is locked for comments

  • Prashant D Profile Picture
    17 on 29 Oct 2024 at 13:02:02
    Cannot connect to on-premise CRM using CrmServiceClient
    Thanks, it worked like charm.
  • Verified answer
    binoyk Profile Picture
    59 on 29 Nov 2018 at 17:18:56
    RE: Cannot connect to on-premise CRM using CrmServiceClient

    Not everyone can be wrong.

    I re-read the whole articles and list of parameters and found that my "Url" parameter was the issue.

    docs.microsoft.com/.../mt608573(v=crm.8)

    My correct connection string becomes like below:

    <connectionStrings>

       <!-- On-premises using Windows integrated security -->

       <add name="CRMConnectionString"

            connectionString="Url=hypernation.crm365.com/hypernation; Username=domain1\user1;Password=test123;Domain=domain1;AuthType=AD;RequireNewInstance=true;"/>

     </connectionStrings>

    </configuration>

  • binoyk Profile Picture
    59 on 28 Nov 2018 at 22:37:37
    RE: Cannot connect to on-premise CRM using CrmServiceClient

    Thanks Ravi for your response.

    I visited both the links and especially Carl's. What he advised I did that way but no luck. Honestly no matter whatsoever thing mentioned in this link i try I am not able to connect using CrmServiceClient. it always shows "IsReady" = false.

    To answer your question. No, it is not IFD environment. It is on-premise.

    Error message I am receiving is Unable to connect Dynamics CRM.

    As I am able to connect using OrganizationServiceProxy, I know I can pass that proxy instance to initialize CrmServiceClient instance but how do I use RequireNewInstance=true property ? (this is my prime requirement)

    Somehow I don't know to tweak the code to use it.

    Please advise.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on 28 Nov 2018 at 22:19:48
    RE: Cannot connect to on-premise CRM using CrmServiceClient

    Hi,

    You can find all combination with respect to the specifis type of environment in the below link-

    docs.microsoft.com/.../mt608573(v=crm.8)

    You can refer this blog as well: carldesouza.com/connecting-to-dynamics-365-using-crmserviceclient

    Is it an IFD environment? What is the error you are getting when using CRMServiceClient? If you are able to connect using OrganizationServiceProxy , any specific reason you want to use CRMServiceClient?

    Hope this helps.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,333 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,262 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans
Loading started
Loading complete