C# 使用Web服务时出错
但它不会在我的crm中创建新记录 错误:无法连接到 净。tcp://103.229.5.53:8201/DynamicsAx/Services/ACX_CaseTab 莱克。这个 连接尝试持续的时间跨度为00:00:21.0658227。传输控制协议 错误代码10060:连接尝试失败,因为已连接 一段时间后,该方未作出适当回应,或 连接失败,因为连接的主机未能响应 103.229.5.53:8201C# 使用Web服务时出错,c#,dynamics-crm,C#,Dynamics Crm,但它不会在我的crm中创建新记录 错误:无法连接到 净。tcp://103.229.5.53:8201/DynamicsAx/Services/ACX_CaseTab 莱克。这个 连接尝试持续的时间跨度为00:00:21.0658227。传输控制协议 错误代码10060:连接尝试失败,因为已连接 一段时间后,该方未作出适当回应,或 连接失败,因为连接的主机未能响应 103.229.5.53:8201 问题可能与CRM Online无法连接包含IP地址的URL有关。这是系统限制。尝试使用域名而不是
问题可能与CRM Online无法连接包含IP地址的URL有关。这是系统限制。尝试使用域名而不是IP发布您面临的错误,以迅速关注您的问题。无法连接到网络。tcp://103.229.5.53:8201/DynamicsAx/Services/ACX_CaseTab 莱克。连接尝试持续的时间跨度为00:00:21.0658227。TCP错误代码10060:连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机没有响应103.229.5.53:8201。即使我在关闭mmy防火墙后运行了它,但仍然不起作用,先生。您为什么又把代码弄乱了?保持正确的代码格式。请在下次发布/编辑您的问题之前参考。谢谢,我已将其修复。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xrm.Sdk;
using Microsoft.Crm.Sdk;
using System.ServiceModel.Discovery;
using System.Runtime.Serialization;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Sdk.Client;
using System.ServiceModel.Description;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
try
{
Program test = new Program();
ClientCredentials cc = new ClientCredentials();
cc.UserName.UserName = "";
cc.UserName.Password = "";
OrganizationServiceProxy service = new OrganizationServiceProxy(new Uri(""), null, cc, null);
string caseid = ""; string casetype = "";
try
{
QueryExpression query1 = new QueryExpression
{
EntityName = "e011_cases",
ColumnSet = new ColumnSet("e011_caseid", "e011_casetype", "e011_casesid"),
Criteria = new FilterExpression()
{
FilterOperator = LogicalOperator.And,
Conditions = {
new ConditionExpression
{
AttributeName ="e011_caseid",
Operator=ConditionOperator.Equal,
Values ={"CRM00000098"}
},
}
}
};
EntityCollection ec = service.RetrieveMultiple(query1);
if(ec.Entities[0].Contains("e011_caseid"))
{
caseid = ec.Entities[0].Attributes["e011_caseid"].ToString();
}
if(ec.Entities[0].Contains("e011_casetype"))
{
EntityReference er = (EntityReference)ec.Entities[0].Attributes["e011_casetype"];
casetype = er.Name.ToString();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message); Console.ReadKey();
}
ACX_CaseTableQ.ACX_CaseTableQServiceClient Proxy = new ACX_CaseTableQ.ACX_CaseTableQServiceClient();
ACX_CaseTableQ.CallContext cnx = new ACX_CaseTableQ.CallContext();
cnx.Company = "1100";
Proxy.ClientCredentials.Windows.ClientCredential.UserName = "";
Proxy.ClientCredentials.Windows.ClientCredential.Domain = "";
Proxy.ClientCredentials.Windows.ClientCredential.Password = "";
ACX_CaseTableQ.AxdACX_CaseTableQ ObjCasetableQ = new ACX_CaseTableQ.AxdACX_CaseTableQ(); string objcase =
Convert.ToString(ObjCasetableQ.Acx_CaseTable_1);
ACX_CaseTableQ.AxdEntity_Acx_CaseTable_1 objAxd = new ACX_CaseTableQ.AxdEntity_Acx_CaseTable_1();
string zipcode = objAxd.Zipcode;
string sate = objAxd.State;
objAxd.CaseID = caseid;
objAxd.CaseCategoryId = casetype; ObjCasetableQ.Acx_CaseTable_1 = new ACX_CaseTableQ.AxdEntity_Acx_CaseTable_1[1] { objAxd };
ACX_CaseTableQ.EntityKey[] ReturnKey = Proxy.create(cnx, ObjCasetableQ);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message); Console.ReadKey();
}
}
}
}