While trying to connect to Dynamics CRM Online via a console application, I was having below error
Unable to
Login to Dynamics CRMOrganizationWebProxyClient is
nullOrganizationWebProxyClient is nullOrganizationServiceProxy is
nullOrganizationServiceProxy is nullOrganizationWebProxyClient is
nullOrganizationServiceProxy is nullOrganizationWebProxyClient is
nullOrganizationWebProxyClient is nullOrganizationServiceProxy is
nullOrganizationServiceProxy is nullOrganizationServiceProxy is null
Below is a specific code that works perfectly fine
public static IOrganizationService getProdOrgService()
{
IOrganizationService organizationService = null;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
ClientCredentials clientCredentials = new ClientCredentials();
clientCredentials.UserName.UserName = ConfigurationManager.AppSettings["D365Username"];
clientCredentials.UserName.Password = ConfigurationManager.AppSettings["D365Password"];
organizationService = (IOrganizationService) new OrganizationServiceProxy(new Uri(ConfigurationManager.AppSettings["orgserviceUrl"]), null, clientCredentials, null);
return organizationService;
}
Add the following
to your AppSettings
<add key="D365Username" value="vipin@vjcity.com" />
<add key="D365Password" value=" vjcity " />
<add key="orgserviceUrl" value="https:// vjcity.crm.dynamics.com//XRMServices/2011/Organization.svc" />
Here are some other links for Troubleshooting and learning:
No comments:
Post a Comment