【发布时间】:2019-05-07 05:20:57
【问题描述】:
当我尝试使用控制台应用程序执行 CRM CRUD 操作时,我收到以下错误:
System.ServiceModel.Security.MessageSecurityException H结果=0x80131501 消息=从另一方收到不安全或不正确安全的故障。有关故障代码和详细信息,请参阅内部 FaultException。 来源=mscorlib
class Program
{
static void Main(string[] args)
{
IOrganizationService _serviceProxy = crmConnection();
Entity con = new Entity("contact");
con["lastname"] = "test";
_serviceProxy.Create(con);
}
private static IOrganizationService crmConnection()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Uri oUri = new Uri("https://XXXXXXXX.api.crm.dynamics.com/XRMServices/2011/Organization.svc");
ClientCredentials clientCredentials = new ClientCredentials();
clientCredentials.UserName.UserName = "XXXXXXXXXXXX";
clientCredentials.UserName.Password = "XXXXXXXXXXXXXXXXXX";
OrganizationServiceProxy _serviceProxy = new OrganizationServiceProxy(oUri, null,clientCredentials,null);
_serviceProxy.Timeout = new TimeSpan(0, 10, 0);
return _serviceProxy;
}
}
提前致谢。
An unsecured or incorrectly secured fault was received from the other party
【问题讨论】:
-
这可能已经回答了:stackoverflow.com/questions/1484601/…。如果没有,请提供更多详细信息,包括您使用的代码。
-
感谢您的回复。已添加代码