【发布时间】:2016-08-08 11:53:49
【问题描述】:
我创建了一个控制台应用程序,它连接到 CRM 并更新 XYZ 实体中的字段。
连接到 CRM 的代码是 -
ClientCredentials credential = new ClientCredentials();
credential.UserName.UserName =user;
credential.UserName.Password = password;
OrganizationServiceProxy proxy = new OrganizationServiceProxy(new Uri(crmEnvironments.ElementAt(currentEnvironment).URL), null, credential, null);
它最初可以很好地连接到 CRM,但一段时间后它会抛出下面提到的错误 -
“元数据包含无法解析的引用”。
内部异常:“无法连接到远程服务器”
在对google做了一些研究之后,我做了以下事情
在 Connect CRM 中插入以下代码行 -
ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain,SslPolicyErrors sslPolicyErrors) { return true; };
在 Appconfig 文件中插入以下内容 -
<system.net>
<defaultProxy useDefaultCredentials="true">
</defaultProxy>
</system.net>
但是错误仍然存在,处理一些记录后连接失败并抛出上述错误。
请帮忙。
【问题讨论】:
标签: dynamics-crm dynamics-crm-2015