Reputation: 125
I am absolutely new with Dynamic CRM. I need to connect one of the online instance of it Dynamic CRM 2015. I was provided SDK and walkthrough. On testing on walkthrough when I change the web config with my details it is generating exception as "An existing connection was forcibly closed by the remote host"
Stack Trace Shows:
[InvalidOperationException: Metadata contains a reference that cannot be resolved: 'https://xxyy.crm5.dynamics.com/XRMServices/2011/Organization.svc?wsdl=wsdl0'.]
when I am trying with browser I get back the result with the same URL:
https://xxyy.crm5.dynamics.com/XRMServices/2011/Organization.svc?wsdl=wsdl0
My connectionString as follows:
<add name="Xrm" connectionString="Server=https://xxyy.crm5.dynamics.com; Domain=xxyy; [email protected]; Password=abc@123456;" />
Any Suggestion.... thanks
Upvotes: 0
Views: 746
Reputation: 21
You can try this for connection:
Declare Globally:
string username = System.Configuration.ConfigurationManager.AppSettings["UserName"];
string password = System.Configuration.ConfigurationManager.AppSettings["Password"];
string serviceUri = System.Configuration.ConfigurationManager.AppSettings["OrganizationServiceUri"];
Use this function for connection
public void ConnectToMSCRM(string UserName, string Password, string ServiceUri)
{
try
{
ClientCredentials credentials = new ClientCredentials();
credentials.UserName.UserName = UserName;
credentials.UserName.Password = Password;
Uri serviceUri = new Uri(ServiceUri);
OrganizationServiceProxy proxy = new OrganizationServiceProxy(serviceUri, null, credentials, null);
proxy.EnableProxyTypes();
_service = (IOrganizationService)proxy;
Response.Write("\n Connected to CRM \n\n");
}
catch (Exception ex)
{
HttpContext.Current.Response.Write("\n Error is : \n\n" + ex.Message);
}
}
Upvotes: 0
Reputation: 103
According to the documentation, the Connection String for Dynamics CRM Online should look like this:
Url=https://contoso.crm.dynamics.com; [email protected]; Password=passcode;
Only 3 parameters are needed:
Your Connection string should look like this:
Url=https://xxyy.crm5.dynamics.com; [email protected]; Password=abc@123456;
Source: MSDN
Upvotes: 1