VS remembers TFS credentials even after clearing cache and deleting from Credential Manager

给你一囗甜甜゛ 提交于 2019-12-11 13:53:02

问题


I wrote a small Winform program that connects to TFS. My problem is that i always succeed to connect to TFS, even when i write the wrong credentials, still, in debug mode i see that my actual credentials are used.

I saw a similar question here and did exactly as suggested, deleted my TFS credentials from Credential Manager, still no luck(Yes, i did exit and re-open VS). I also logged out ot TFS itself and removed the connection on visual studio. Also, i deleted the cache folder as suggested here.

my code looks something like that:

folderPath=@"$/TFS_PATH";

cred = new NetworkCredential(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["pass"]);

tfs = new TeamFoundationServer("CollectionPath", cred);

tfs.EnsureAuthenticated();

MessageBox.Show("tfs.EnsureAuthenticated() succeeded");

Some explantions for the code:

cred is an instance of NetworkCredential

tfs is an instance of TeamFoundationServer

The username and password are in app.config. Somehow, it completely ignores it, and uses my real credentials.

Does anyone know what else can i do? My goal is to enable the TFS connection from any computer/server by the username and password that are stored in app.config ONLY, not depend on the credentials that are stored on the machine iteself already.

Thanks


回答1:


There were two credentials that you had to remove. One under "Windows Credentials", and another under "Generic Credentials".

It automatically uses the crendentials of the windows user that is logged-in.

You should run Visual Studio using the crendetials which you want to use to connect to TFS. See https://social.msdn.microsoft.com/Forums/vstudio/en-US/a239a959-1c01-4592-a754-f6fc7d5a9b94/change-user-when-i-connect-to-team-foundation-server?forum=tfsgeneral for more details.




回答2:


The problem was that i wasn't properly disconnected from VS. Removing the connection wasn't enough. I needed to verify that i signed out: Open VS, click on "Connect to Team Foundation..." and then click "sign out" on the bottom left in the popup window. That's it.



来源:https://stackoverflow.com/questions/34490310/vs-remembers-tfs-credentials-even-after-clearing-cache-and-deleting-from-credent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!