gpt4 book ai didi

asp.net - IIS7 模拟无法访问 TFS 存储库

转载 作者:行者123 更新时间:2023-12-02 21:07:25 24 4
gpt4 key购买 nike

我正在尝试构建一个在 TFS 中添加工作项的 ASP.NET 页面。

我已启用模拟和 Windows 身份验证:

<authentication mode="Windows" />
<identity impersonate="true" password="" userName="" />
<customErrors mode="Off" />

在该页面中,我访问 TFS 并尝试添加工作项:

TfsTeamProjectCollection prjCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("xxx"));
WorkItemStore store = prjCollection.GetService<WorkItemStore>();
...

但是,仅当我在 ASP.NET 模拟 中选择 SpecificUser 并存储凭据时,它才有效。当选择经过身份验证的用户时,它不起作用。

我已检查 SpecificUser 与 Authenticated User 是否相同,但在后一种情况下我收到权限错误(这表明模拟无法正常工作)。

TF30063: You are not authorized to access XXX. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.TeamFoundation.Client.TeamFoundationClientProxyBase.AsyncWebRequest.ExecRequest(Object obj)
--- End of inner exception stack trace ---
at Microsoft.TeamFoundation.Client.TeamFoundationClientProxyBase.ProcessHttpResponse(HttpWebResponse response, Stream responseStream, WebException webException, XmlReader& xmlResponseReader)
at Microsoft.TeamFoundation.Client.TeamFoundationClientProxyBase.ExecWebServiceRequest(HttpWebRequest request, XmlWriter requestXml, String methodName, HttpWebResponse& response)
at Microsoft.TeamFoundation.Framework.Client.LocationWebService.Connect(Int32 connectOptions, ServiceTypeFilter[] serviceTypeFilters, Int32 lastChangeId)
at Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.Connect(ConnectOptions connectOptions)
at Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.EnsureConnected(ConnectOptions optionsNeeded)
at Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.get_InstanceId()
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.InitializeInternal()
at Microsoft.TeamFoundation.Client.TfsTeamProjectCollection.InitializeTeamFoundationObject(String fullName, Object instance)
at Microsoft.TeamFoundation.Client.TfsConnection.CreateServiceInstance(Assembly assembly, String fullName)
at Microsoft.TeamFoundation.Client.TfsConnection.GetService(Type serviceType)
at Microsoft.TeamFoundation.Client.TfsConnection.GetService[T]()
at ASP.index_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer)

以下变量在两种情况下看起来相同:

HttpContext.Current.Request.LogonUserIdentity.Name
HttpContext.Current.Request.IsAuthenticated
HttpContext.Current.User.Identity.Name
System.Environment.UserName
System.Security.Principal.WindowsIdentity.GetCurrent().Name

有什么想法吗?

编辑:

事实上,正如 John 在下面提到的,该问题是由 Kerberos 委托(delegate)引起的。

Kerberos Delegation

我发现以下文章和随附的工具对于解释和缓解此问题非常有用:

DelegConfig - A Tool To help resolve Kerberos authentication and delegation issues

Kerberos Delegation Check

最佳答案

我想你可能有一个 "double hop"问题。

关于asp.net - IIS7 模拟无法访问 TFS 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9695671/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com