C# Crm 2011 调用方未通过服务身份验证
本文关键字:服务 身份验证 方未通 调用 Crm 2011 | 更新日期: 2023-09-27 18:32:24
我写了应用程序是由c#编写的代码,表单application.crm正在使用SSL运行。
ClientCredentials credential = new ClientCredentials();
credential.Windows.ClientCredential = new
System.Net.NetworkCredential("username", "password", "domain");
Uri organizationUri = new Uri("https://serverAdress/Orgname/XRMServices/2011/Organization.svc");
Uri homeRealUri = null;
serviceProxy = new OrganizationServiceProx
(organizationUri, homeRealUri, credential, null);
serviceProxy.EnableProxyTypes();
我也尝试了这个版本。
> ClientCredentials Credentials = new ClientCredentials();
> Credentials.Windows.ClientCredential.UserName ="<username>";
> Credentials.Windows.ClientCredential.Password ="<password>";
它不会抛出任何异常,但服务代理无法进行身份验证。如何解决?任何建议。
老问题,但这是我的建议。
看看这里提供的示例代码:http://msdn.microsoft.com/en-us/library/hh675404.aspx
只需更改以下条目即可满足您的需求
private String _discoveryServiceAddress = "https://dev.crm.dynamics.com/XRMServices/2011/Discovery.svc";
private String _organizationUniqueName = "OrganizationUniqueName";
// Provide your user name and password.
private String _userName = "username@mydomain.com";
private String _password = "password";
// Provide domain name for the On-Premises org.
private String _domain = "mydomain";
控制台应用应打印出来:登录用户是"名字"姓氏"。然后,您可以从以下位置获取 OrganizationServiceProxy:
using (OrganizationServiceProxy organizationProxy =
GetProxy<IOrganizationService, OrganizationServiceProxy>(orgServiceManagement, credentials))
并使用它。