我正在尝试在使用TFS2010 API的ASP.NET网站内启用直通或模拟身份验证。
我在Cassini上可以正常工作,但是在IIs7.5(Windows7)上有问题。
我找到了
this blog post
关于这个问题,并尝试了以下方法:
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身份验证模块):
<authentication mode="Windows"/>
<identity impersonate="true" />
有什么明显的事情我错过了吗?