我编写的代码是应用程序是由c#form 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>";
它不会抛出任何异常,但serviceProxy无法进行身份验证。如何修复? 任何建议。
答案 0 :(得分:0)
老问题,但这是我的建议。
请查看此处提供的示例代码: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))
并使用它。