0

I've a .NET application, that connects to a TFS server and plays a little bit with the work items. The application gets all its parameters like server, user, password etc. via command line parameters. This works well on all tested client windows OS (Win7, Win8). But running the command line on a Windows Server 2008 R2 a popup is shown, where the user has to provide his credentials.

Why is this happening only on the server OS? Are there any OS settings, to prevent the dialog (since the tool should be included in an build machine)?

Here is the code:

string completeURL = server + "/" + collection;
Uri uri= new Uri(completeURL);
var tpc = new TfsTeamProjectCollection(uri, new System.Net.NetworkCredential(user, passwd));

WorkItemStore _workItemStore = new WorkItemStore(tpc);
Konrad
  • 4,329
  • 10
  • 54
  • 88
  • Would be good to see the exact code you use to connect – Giulio Vian Jan 28 '15 at 10:30
  • Added the few lines to connect to tfs – Konrad Jan 28 '15 at 10:40
  • Is the tool running on the same Windows Server machine? – Giulio Vian Jan 28 '15 at 10:49
  • The tool runs perfectly in command line on Windows 7 and a Windows 8 machine. On a Windows 2008 R2 machine, the credential dialogue pops up. – Konrad Jan 28 '15 at 11:17
  • Sorry my question is: the Win2008 where the tool fails, is the TFS server or another machine? – Giulio Vian Jan 28 '15 at 11:53
  • Nope. TFS is on another machine. – Konrad Jan 28 '15 at 12:58
  • Do you want to log in to TFS as the logged in user? then use the System.Net.CredentialCache.DefaultCredentials instead of creating new a new networkcredential. If you need to pass in user and password then like Giulio mentioned it might be a proxy blocking you. Is the server on the same domain? Is it attached to a domain for that mater (if on a workgroup then perms are different). You could also add you user and password to the windows credential store for your TFS server. – Etienne Feb 04 '15 at 20:12

1 Answers1

0

I would add

tpc.EnsureAuthenticated();

to force connection.

Also check the IE proxy configuration on the Win2008 machine. Could be that the calls go via an authenticated, your code is not accounting for.

Giulio Vian
  • 8,248
  • 2
  • 33
  • 41