2016-09-30 33 views
1

正嘗試使用2016 SDK創建連接到CRM 2016(On Prem)的控制檯應用程序。導致錯誤的新CRM連接代碼

下面的代碼失敗。 conn.LastCrmError具有以下詳細信息,並且orgService爲null。

無法登錄Dynamics CRMOrganizationWebProxyClient爲null OrganizationServiceProxy爲null OrganizationWebProxyClient爲null OrganizationServiceProxy爲null。運行時的舊代碼,下面,使用2015年SDK

var connectionString = @"Url=http://wxxxxx/xxxx/; Username=xxxxx; Password=xxxxx;"; 
      IOrganizationService orgService2 = new OrganizationService(CrmConnection.Parse(connectionString)); 
      var results = orgService2.Execute(new WhoAmIRequest()); 

就如何解決這個任何建議

var connectionString = @"Url=http://xxxx/xxxx/; Username=xxxx; Password=xxxx;"; 
      CrmServiceClient conn = new CrmServiceClient(connectionString); 
      IOrganizationService orgService = conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy; 

連接正常?

回答

0
Unable to Login to Dynamics CRMOrganizationWebProxyClient is nullOrganizationServiceProxy is nullOrganizationServiceProxy is null 

當您無法連接到CRM實例時,在大多數情況下會引發此異常。你確定你的連接字符串正確嗎? Here是描述的連接字符串。也許缺乏'域'屬性是問題?