tags:

views:

73

answers:

1

At my company we have recently set up a TeamFoundation proxy to our TeamFoundationServer. I have written a C# app, that connects to the TFS to query various things. Now, I want the app to support connection over the TFS proxy as well. As I am not really familiar with TFS, I am having some difficulties. Ideally, I want the application to only "know" the TFS proxy and have it act just like the normal TFS. Is this even possible?

What I am doing is something like this:

TfsTeamProjectCollection projects = 
    new TfsTeamProjectCollection(new Uri(serverUriString, 
                                 new NetworkCredential(username, password, domain));

This works fine if serverUriString is the TFS (e.g. "http://MyTfs:8080"). When I substitute this with the TFS proxy (e.g. "http://MyTfsProxy:8081") I get some unspecific TeamFoundationServiceUnavailableException, where at the end it states that a http 404 error occurred. The 404 doesn't make much sense to me, I am able to ping the server, I can connect to it from the browser and Visual Studio acceppts it as well. Do I need to set a connection to the TFS AND the proxy? If yes, how do I do that?

A: 

Under the hood the main TFS server is simply a collection of web services. The 404 indicates that the expected web service doesn't exist at the URL you specified.

Now the thing with the TFS Proxy is that it is only for source control operations (i.e. get latest, etc). For everyting else you still connect to the main TFS server, and that includes being authenticated, which is what you are doing when establishing the connection to the project collection in your sample.

I don't have a code sample handy, but from memory for source control operations you'll need to get a VersionControlServer object from the project collection object (using GetService), and then call AddProxy on it to add the URL for your proxy server. After that, source operations should work via the proxy server. (I'm sure someone will correct me if I'm wrong).

Richard Banks