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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Cannot connect to two different organizations on one class

(0) ShareShare
ReportReport
Posted on by 5

Hello everyone, we are having a brand new issue. Until about the 1st of this month we were able to connect to two different CRM online organizations on the same console application where we take certain data from one and do work on the other org. 

When we connect to organization 1, and then we try to connect to organization 2 the CrmServiceClient object stays pointing at organization 1. For example:

private static void test()
{
CrmServiceClient crmSvc = new CrmServiceClient(ConfigurationManager.ConnectionStrings["CRMCloudProd"].ConnectionString);
Console.WriteLine(crmSvc.ConnectedOrgFriendlyName);

Prints our production environment

usertest2();

}
private static void test2()
{
CrmServiceClient crmSvc2 = new CrmServiceClient(ConfigurationManager.ConnectionStrings["CRMCloudSandbox"].ConnectionString);
Console.WriteLine(crmSvc2.ConnectedOrgFriendlyName);

Prints our production environment still 
}

If we flip it, so that CRMCloudSandbox is the first CRM being pointed to, both functions will print Sandbox environment

Before this month, we were able to make use of both environments in the same class.

My questions is: is this a bug or an intended change? If this is intended; how could I interact between the two environments again? use two different classes?

I have the same question (0)
  • Djmendez55 Profile Picture
    5 on at

    Update:

    I tried using the Dispose() method:

    CrmServiceClient crmSvc = new CrmServiceClient(ConfigurationManager.ConnectionStrings["CRMCloudProd"].ConnectionString);

               Console.WriteLine("1: " + crmSvc.ConnectedOrgFriendlyName);

               crmSvc.Dispose();

               Console.WriteLine("2: " + crmSvc.ConnectedOrgFriendlyName);

               crmSvc = new CrmServiceClient(ConfigurationManager.ConnectionStrings["CRMCloudSandbox"].ConnectionString);

               Console.WriteLine("3: " +crmSvc.ConnectedOrgFriendlyName);

    but would print out the same issue:

    1: Production

    2:

    3:  Production

    again if we tried them the other way around

    1: Sandbox

    2:

    3: Sandbox.

    I also tried putting the second function on a separate namespace and class, that did not work either.

  • Verified answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    Hi,

    You need to add below setting in your connection string -

    RequireNewInstance=true

    crmtipoftheday.com/.../

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • Djmendez55 Profile Picture
    5 on at

    Thank you! this was it

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 196 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 129

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans