I’m definitive new on Dynamic CRM 2011, so maybe this question is really easy.
I’m connecting throw a WCF Service to different instances of CRM whit this part of code:
var settings = new ConnectionStringSettings("Xrm", connectionString);
var connection = new CrmConnection(settings);
using (var xrm = new XrmServiceContext(connection))
{
//do the magic here
}
The “connectionString” parameter, is a string containing the connection string of the CRM.
So, the problem is that the first time it’s connects fine to the server that I write in the connectionString, but then, It always connect to the same server, I mean, even if I change the server address, always tries to connect to the first one.
Debugging, I look in the
var connection = new CrmConnection(settings);
And is always the same connection to the first server….
So, I need a way to dispose that connection, or force the constructor to always create a new instance… or something like that…
But I can’t find the method, or operation that do that…
Thanks in advance!
Ok, I found a solution, I don’t know if is the best solution, but it works…
Instead of using this
I use
That’s giving me the same result, and always with the right connection string