【发布时间】:2014-07-16 19:50:55
【问题描述】:
我在我的 CRM 实例上配置了基于声明的身份验证。我正在使用自定义 STS(示例可用 here) 现在我想从一些测试应用程序访问 Web 服务。 有没有人有这方面的例子? 在 Windows 身份验证的情况下,我尝试使用相同的代码进行连接。但是,当然,不成功。 我收到一个错误:
{"未在配置的身份验证端点 Kerberos 上找到 安全令牌服务!"}
这是连接代码(用于 AD 认证类型):
OrganizationServiceProxy orgserv;
ClientCredentials clientCreds = new ClientCredentials();
ClientCredentials devCreds = new ClientCredentials();
clientCreds.Windows.ClientCredential.UserName = "user";
clientCreds.Windows.ClientCredential.Password = "P@$$w0rd";
clientCreds.Windows.ClientCredential.Domain = "myDomain";
IServiceConfiguration<IOrganizationService> orgConfigInfo =
ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(new Uri("https://myCRMServer/myOrg/XRMServices/2011/Organization.svc"));
using (orgserv = new OrganizationServiceProxy(orgConfigInfo, clientCreds))
{
orgserv.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
orgserv.EnableProxyTypes();
connection = orgserv;
}
我在某处发现,对于基于声明的身份验证,仅发送 UPN(用户主体名称)就足够了。但同样的错误也会发生。我也尝试了用户名/密码组合,但不成功。
AuthenticationCredentials authCredentials = new AuthenticationCredentials();
...
authCredentials.UserPrincipalName = "user";
...
authCredentials.ClientCredentials.UserName.UserName = _userName;
authCredentials.ClientCredentials.UserName.Password = _password;
这之后的错误是:The authentication endpoint Username was not found on the configured Secure Token Service!
【问题讨论】:
标签: c# dynamics-crm-2011 dynamics-crm claims-based-identity sts-securitytokenservice