域验证方式
OrganizationServiceProxy
Uri orgServiceUri = new Uri(CRMServiceUrl + "/XRMServices/2011/Organization.svc");
ClientCredentials credentials = new ClientCredentials();
if (CRMAuthenticationType == "AD")
{
credentials.Windows.ClientCredential = new System.Net.NetworkCredential(CRMUserName, CRMUserPassword, CRMUserDomainName);
}
else if (CRMAuthenticationType == "ADFS")
{
credentials.UserName.UserName = CRMUserDomainName + "\\" + CRMUserName;
credentials.UserName.Password = CRMUserPassword;
}
OrganizationServiceProxy crmServiceProxy = new OrganizationServiceProxy(orgServiceUri, null, credentials, null);
crmService = (IOrganizationService)crmServiceProxy;
OrganizationService
ClientCredentials credentials = new ClientCredentials();
if (CRMAuthenticationType == "AD")
{
credentials.Windows.ClientCredential = new System.Net.NetworkCredential(CRMUserName, CRMUserPassword, CRMUserDomainName);
}
else if (CRMAuthenticationType == "ADFS")
{
credentials.UserName.UserName = CRMUserDomainName + "\\" + CRMUserName;
credentials.UserName.Password = CRMUserPassword;
}
string server = string.Format("Url={0};Domain={1};Username={2};Password={2}", CRMServiceUrl, CRMUserDomainName, CRMUserName, CRMUserPassword);
var connection = CrmConnection.Parse(server);
connection.ProxyTypesAssembly = Assembly.GetExecutingAssembly();
connection.ClientCredentials = credentials;
m_CrmService = new OrganizationService(connection);
m_SvcContext = new ServiceContext(m_CrmService);
本文详细介绍了在CRM服务中使用域验证进行身份验证的方法,包括基于Active Directory (AD) 和 Active Directory Federation Services (ADFS) 的认证流程。通过配置客户端凭据,实现与CRM服务的无缝集成。
5126

被折叠的 条评论
为什么被折叠?



