Reputation: 105
I have to connect TFS via API which already works fine when I am within my lan, but now I have to connect to a TFS over a webproxy. I am able to connect to the serverstatus.asmx via browser.
I already tried to set a environment variable and added the <defaultProxy> property to app.config - but without success.
Now I tried to do the same with a httpwebrequest
:
System.Net.HttpWebRequest request = System.Net.WebRequest.Create(tfs_uri) as System.Net.HttpWebRequest;
request.Credentials = tfs_cred;
System.Net.WebProxy p = new System.Net.WebProxy("http://proxy.local.lan:8080/");
p.UseDefaultCredentials = true;
request.Proxy = p;
System.Net.WebResponse response = request.GetResponse();
This code can connect to the TFS. If I remove proxy definition and add the defaultProxy
tag into app.config - I get the same error message when connecting a TfsConfigurationServer
object.
My assumption is: TFS API does not support web proxies. Is this correct?
Can somebody tell me that my assumption is wrong?
Upvotes: 1
Views: 826
Reputation: 23434
You can, but it is a bit more convoluted than just setting the proxy details. Because TFS makes lots of seperate calls under the hood you will not be able to use the methods above.
Try adapting Rido's post below:
I would think that you should be able to integrate this method into your own applicaiton.
Upvotes: 1