【发布时间】:2016-08-25 04:06:53
【问题描述】:
我有一个执行此操作的 powershell 脚本:
$uri = "$($tfsUri)/$($teamproject)/_apis/build/builds/$($buildID)?api-version=2.0"
$data = @{keepForever = $keepForever} | ConvertTo-Json
$response = $webclient.UploadString($uri,"PATCH", $data)
我正在尝试使用 Web 客户端在 C# 中重写它。
WebClient client = new WebClient();
client.Encoding = System.Text.Encoding.UTF8;
string reply = client.UploadString(url, "keepForever = true");
Console.WriteLine(reply);
但我得到:远程服务器返回错误:(401) Unauthorized.
这是 TFS 2015 VNext,如果有帮助的话。
【问题讨论】: