Sdk SecurityTokenRespone为空

Sdk SecurityTokenRespone为空,sdk,dynamics-crm,adfs,dynamics-crm-365,Sdk,Dynamics Crm,Adfs,Dynamics Crm 365,正如我在标题中所述,我对SecurityTokenRespone有问题 IServiceManagement serviceManagement=ServiceConfigurationFactory.CreateManagement(新Uri(“https://SERVICE_URI")); AuthenticationCredentials authCreds=新的AuthenticationCredentials(); authCreds.ClientCredentials.UserNam

正如我在标题中所述,我对SecurityTokenRespone有问题

IServiceManagement serviceManagement=ServiceConfigurationFactory.CreateManagement(新Uri(“https://SERVICE_URI"));
AuthenticationCredentials authCreds=新的AuthenticationCredentials();
authCreds.ClientCredentials.UserName.UserName=用户名;
authCreds.ClientCredentials.UserName.Password=密码;
AuthenticationCredentials-tokenCreds=serviceManagement.Authenticate(authCreds);
SecurityTokenResponse securityToken=tokenCredentials.SecurityTokenResponse;
当我调用生产CRM时,我得到SecurityTokenRespone,但当我调用测试CRM时,SecurityTokenRespone为空

这是因为我们的生产CRM配置了ADF,而测试CRM没有

如果是,是否可以以某种方式绕过它(我们的测试CRM位于不能暴露于internet的域中)


谢谢:)

我假设您在测试CRM上使用的是纯广告登录,而不是ADF。如果是,则无法获取安全令牌,因为这里没有安全令牌。要获得组织服务,请执行以下操作:

ClientCredentials clientCreds=newclientcredentials();
clientCreds.Windows.ClientCredential.UserName=“UserName”;
clientCreds.Windows.ClientCredential.Password=“pass”;
clientCreds.Windows.ClientCredential.Domain=“Domain”;
IServiceConfiguration orgConfigInfo=ServiceConfigurationFactory.CreateConfiguration(新Uri(“http://yourcrmserver/CRO/XRMServices/2011/Organization.svc"));
OrganizationServiceProxy orgserv=新的OrganizationServiceProxy(orgConfigInfo,clientCreds);

是的,安装了测试CRM的服务器上没有ADF。我们使用Dynamcis CRM 365,因此我将使用
CrmServiceClient
获得到CRM的连接。Thx:)