我正在尝试在使用 TFS2010 API 的 ASP.NET 网站内启用直通或模拟身份验证。
我在 Cassini 上可以正常工作,但是在 IIS 7.5 (Windows 7) 中出现了问题。
我找到了关于这个主题的这篇博文,并尝试了以下方法:
private static void Test()
{
TfsTeamProjectCollection baseUserTpcConnection =
new TfsTeamProjectCollection(new Uri(Settings.TfsServer));
// Fails as 'baseUserTpcConnection' isn't authenticated
IIdentityManagementService ims =
baseUserTpcConnection.GetService<IIdentityManagementService>();
// Read out the identity of the user we want to impersonate
TeamFoundationIdentity identity = ims.ReadIdentity(
IdentitySearchFactor.AccountName,
HttpContext.Current.User.Identity.Name,
MembershipQuery.None,
ReadIdentityOptions.None);
TfsTeamProjectCollection impersonatedTpcConnection = new
TfsTeamProjectCollection(new Uri(Settings.TfsServer),
identity.Descriptor);
}
当我使用卡西尼时,除了
collection = new TfsTeamProjectCollection(new Uri(server));
我已启用 web.config 设置(并安装了 Windows Auth 模块):
<authentication mode="Windows"/>
<identity impersonate="true" />
有什么明显的我错过了吗?