使用发布管理,我正在尝试执行 Powershell 以使用 InitiateRelease REST API 创建新版本。我在本地使用带有 RM Server 的 Update 4。
我得到的响应是 500 错误。在 RM 服务器上,没有记录错误。然而 Fiddler 提供了更多细节:
{“Message”:“发生错误。”,“ExceptionMessage”:“字典中不存在给定的键。”,“ExceptionType”:“System.Collections.Generic.KeyNotFoundException”,“StackTrace”:”在System.Web.Http.ApiController.d__1.MoveNext()\r\n--- 从先前引发异常的位置结束堆栈跟踪 ---\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task任务)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 System.Web.Http.Dispatcher.HttpControllerDispatcher.d__0.MoveNext()"}
这是我的PS1。
$releaseDefinition = "MyReleaseTemplateName"
$releaseName = $releaseDefinition + (Get-Date).DateTime
$deploymentPropertyBag = "{
""MyComponentName:Build"" : ""MyBuildNumber"",
""ReleaseName"" : ""$releaseName""
}"
$propertyBag = [System.Uri]::EscapeDataString($deploymentPropertyBag)
$url = "http://myserver:1000/account/releaseManagementService/_apis/releaseManagement/OrchestratorService/InitiateRelease?releaseTemplateName=" + $releaseDefinition + "&deploymentPropertyBag=" + $propertyBag + "&api-version=3.0"
Write-Host $url
$wc = New-Object System.Net.WebClient
$wc.UseDefaultCredentials = $true
$releaseId = $wc.UploadString($url,"")