If you are not able to connect to the CRM Server from the different domain machine then change your code according to the below code: (changes are mentioned in bold)
public static OrganizationServiceProxy getCrmService()
{
ClientCredentials creds = new ClientCredentials();
creds.Windows.ClientCredential.UserName = ConfigurationManager.AppSettings.Get("UserName");
creds.Windows.ClientCredential.Password = ConfigurationManager.AppSettings.Get("password");
IOrganizationService OrgService = (IOrganizationService)new OrganizationServiceProxy
(new Uri(ConfigurationManager.AppSettings.Get("URL")), null, creds, null);
var osp = OrgService as OrganizationServiceProxy;
osp.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
return osp;
}
it works for me so I hope it will work for you..if any other issue please let me know
No comments:
Post a Comment