SecurityTokenRespone 为空
SecurityTokenRespone is null
正如我在标题中所述,我对 SecurityTokenRespone 有疑问。
IServiceManagement<IOrganizationService> serviceManagement = ServiceConfigurationFactory.CreateManagement<IOrganizationService>(new Uri("https://SERVICE_URI"));
AuthenticationCredentials authCreds = new AuthenticationCredentials();
authCreds.ClientCredentials.UserName.UserName = userName;
authCreds.ClientCredentials.UserName.Password = password;
AuthenticationCredentials tokenCreds = serviceManagement.Authenticate(authCreds);
SecurityTokenResponse securityToken = tokenCredentials.SecurityTokenResponse;
当我调用生产 CRM 时,我得到了 SecurityTokenRespone,但是当我调用我们的测试 CRM 时,SecurityTokenRespone 为空...
这是因为我们的生产 CRM 配置了 ADFS 而测试 CRM 没有配置吗?
如果是,能否以某种方式绕过它(我们的测试 CRM 位于无法暴露于 Internet 的域中)?
谢谢:)
我假设在您的测试 CRM 上,您只使用没有 ADFS 的普通 AD 登录。如果是,那么您无法获得安全令牌,因为这里没有。要获得组织服务,您需要:
ClientCredentials clientCreds = new ClientCredentials();
clientCreds.Windows.ClientCredential.UserName = "username";
clientCreds.Windows.ClientCredential.Password = "pass";
clientCreds.Windows.ClientCredential.Domain = "domain";
IServiceConfiguration<IOrganizationService> orgConfigInfo = ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(new Uri("http://yourcrmserver/CRO/XRMServices/2011/Organization.svc"));
OrganizationServiceProxy orgserv = new OrganizationServiceProxy(orgConfigInfo, clientCreds);
正如我在标题中所述,我对 SecurityTokenRespone 有疑问。
IServiceManagement<IOrganizationService> serviceManagement = ServiceConfigurationFactory.CreateManagement<IOrganizationService>(new Uri("https://SERVICE_URI"));
AuthenticationCredentials authCreds = new AuthenticationCredentials();
authCreds.ClientCredentials.UserName.UserName = userName;
authCreds.ClientCredentials.UserName.Password = password;
AuthenticationCredentials tokenCreds = serviceManagement.Authenticate(authCreds);
SecurityTokenResponse securityToken = tokenCredentials.SecurityTokenResponse;
当我调用生产 CRM 时,我得到了 SecurityTokenRespone,但是当我调用我们的测试 CRM 时,SecurityTokenRespone 为空...
这是因为我们的生产 CRM 配置了 ADFS 而测试 CRM 没有配置吗?
如果是,能否以某种方式绕过它(我们的测试 CRM 位于无法暴露于 Internet 的域中)?
谢谢:)
我假设在您的测试 CRM 上,您只使用没有 ADFS 的普通 AD 登录。如果是,那么您无法获得安全令牌,因为这里没有。要获得组织服务,您需要:
ClientCredentials clientCreds = new ClientCredentials();
clientCreds.Windows.ClientCredential.UserName = "username";
clientCreds.Windows.ClientCredential.Password = "pass";
clientCreds.Windows.ClientCredential.Domain = "domain";
IServiceConfiguration<IOrganizationService> orgConfigInfo = ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(new Uri("http://yourcrmserver/CRO/XRMServices/2011/Organization.svc"));
OrganizationServiceProxy orgserv = new OrganizationServiceProxy(orgConfigInfo, clientCreds);