Web services 远程资源的编程模拟委派(双跳)

Web services 远程资源的编程模拟委派(双跳),web-services,c#-4.0,kerberos,impersonation,kerberos-delegation,Web Services,C# 4.0,Kerberos,Impersonation,Kerberos Delegation,我很难让运行时模拟正常工作 场景: 在所有服务器中禁用匿名访问,并启用windows身份验证 客户端调用Web Api 1 Web Api 1可以调用Web Api 2或oData服务 需要使用客户端凭据模拟从Web Api 1到Web Api 2的调用 不能模拟从Web Api 1到oData服务的调用 Web Api 1使用Web请求调用这两个服务 我们已正确配置Kerberos委派 什么有效(有点): 如果我使用Web.config在Web Api 1中启用模拟 结果: 未模拟从W

我很难让运行时模拟正常工作

场景:

  • 在所有服务器中禁用匿名访问,并启用windows身份验证
  • 客户端调用Web Api 1
  • Web Api 1可以调用Web Api 2或oData服务
  • 需要使用客户端凭据模拟从Web Api 1到Web Api 2的调用
  • 不能模拟从Web Api 1到oData服务的调用
  • Web Api 1使用Web请求调用这两个服务
  • 我们已正确配置Kerberos委派

什么有效(有点):

如果我使用Web.config在Web Api 1中启用模拟

结果:

  • 未模拟从Web Api 1到oData的调用(如预期的那样)
  • 也不会模拟从Web Api 1到Web Api 2的调用。这就是问题所在。
问题:

  • 这就是在Web服务中实现运行时模拟的方式吗
  • 我们做错了什么

任何指针都会很有帮助。

问题中提到的代码有效!!授权存在一些问题,需要解决


感谢

已在域名上配置委派。并且服务器配置为使用IP地址。为域配置了委派的哪一部分?什么服务器设置?你能说得更具体些吗?我现在正在经历完全相同的问题。
<authentication mode="Windows"/>
<identity impersonate="true"/>
<authentication mode="Windows"/>
<identity impersonate="false"/>
// Impersonate the currently authenticated User
using (((WindowsIdentity)HttpContext.Current.User.Identity).Impersonate()) {
    var request = (HttpWebRequest)HttpWebRequest.Create(uri);
    ...
    ...
    request.Credentials = CredentialCache.DefaultCredentials;

    response = (HttpWebResponse)request.GetResponse();
};