我正在尝试使用新的发布功能和本地托管的 VSO 代理将多个网站部署到 Azure。
它确实部署到 Azure 中的一个网站,但其他网站都失败了,我看不出它们的设置有什么不同:相同的订阅,相同的属性甚至托管在同一个 Azure VM 上......
我得到的错误在 vso-log 中:
06:59:15.489161 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = Looking for Azure PowerShell module at C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1)
06:59:16.467323 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = AzurePSCmdletsVersion= 1.0.4)
06:59:16.485822 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = Get-ServiceEndpoint -Name xxxxxxxx-c8b1-4f15-b59d-0d453e7bd3c5 -Context Microsoft.TeamFoundation.DistributedTask.Agent.Worker.Common.TaskContext)
06:59:17.029746 Process logging event with task handler.
06:59:17.029746 BaseLogger.LogStatus(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, scope.TimelineRecordId = 52fb11d3-73c4-4ac8-a975-88b832a486e8, record.Name = )
06:59:17.029746 Process logging event with task handler.
06:59:17.029746 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = subscription= BizSpark)
06:59:17.049540 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = Get-X509Certificate -CredentialsXml <xml>)
06:59:17.139173 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = azureSubscriptionId= xxxxxxxx-d906-4f32-9eda-a51708827ea3)
06:59:17.139173 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = azureSubscriptionName= BizSpark)
06:59:17.139173 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = azureServiceEndpoint= https://management.core.windows.net/)
06:59:17.159043 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = Set-AzureSubscription -SubscriptionName BizSpark -SubscriptionId xxxxxxxx-d906-4f32-9eda-a51708827ea3 -Certificate <cert> -Environment AzureCloud)
06:59:17.201634 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = Select-AzureSubscription -SubscriptionId xxxxxx-d906-4f32-9eda-a51708827ea3)
06:59:17.268742 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ConnectedServiceName= 28ab7968-c8b1-4f15-b59d-0d453e7bd3c5)
06:59:17.268742 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = WebSiteName= my-azure-website)
06:59:17.268742 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = Package= d:\b\5581ca786\Complete Build\dotNetComponents\Reporting\obj\Release\Package\WebDeploy.zip)
06:59:17.268742 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = Slot= )
06:59:17.268742 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = AdditionalArguments= )
06:59:17.268742 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = packageFile= Find-Files -SearchPattern d:\b\5581ca786\Complete Build\dotNetComponents\Reporting\obj\Release\Package\WebDeploy.zip)
06:59:17.268742 FindFiles.FindMatchingFiles(rootFolder = , matchPattern = d:\b\5581ca786\Complete Build\dotNetComponents\Reporting\obj\Release\Package\WebDeploy.zip, includeFiles = True, includeFolders = False
06:59:17.268742 FindFiles.GetMatchingItems(includePatterns.Count = 1, excludePatterns.Count = 0, includeFiles = True, includeFolders = False
06:59:17.268742 FindFiles.GetMatchingItems - Found: d:\b\5581ca786\Complete Build\dotNetComponents\Reporting\obj\Release\Package\WebDeploy.zip
06:59:17.279765 FindFiles.FindMatchingFiles - Found 1 matches
06:59:17.279765 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = packageFile= d:\b\5581ca786\Complete Build\dotNetComponents\Reporting\obj\Release\Package\WebDeploy.zip)
06:59:17.279765 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = Get-AzureWebSite -Name my-azure-website -ErrorAction SilentlyContinue -ErrorVariable azureWebSiteError -Slot production)
06:59:18.311104 Process logging event with task handler.
06:59:18.311104 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning]System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.Management.Automation.PSInvalidOperationException: There is no Runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property of the System.Management.Automation.Runspaces.Runspace type. The script block you attempted to invoke was: $CurrentSession.ignoreCert)
06:59:18.311104 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning] at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult))
06:59:18.311104 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning] at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar))
06:59:18.311104 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning] --- End of inner exception stack trace ---)
06:59:18.328418 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning] at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult))
06:59:18.328418 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning] at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar))
06:59:18.328418 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning] --- End of inner exception stack trace ---)
06:59:18.328418 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning] at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task))
06:59:18.328418 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning] at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task))
06:59:18.328418 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning] at Microsoft.WindowsAzure.Management.WebSites.WebSpaceOperationsExtensions.List(IWebSpaceOperations operations))
06:59:18.328418 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning] at Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebSitesManagementExtensionMethods.GetFromAzure(IWebSiteManagementClient client, String website))
06:59:18.328418 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning] at Microsoft.WindowsAzure.Commands.Utilities.Websites.WebsitesClient.GetWebsite(String name))
06:59:18.328418 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning] at Microsoft.WindowsAzure.Commands.Websites.GetAzureWebsiteCommand.<GetByName>b__0())
06:59:18.328418 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning] at Microsoft.WindowsAzure.Commands.Websites.GetAzureWebsiteCommand.Do(Action call))
06:59:18.328418 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[warning] at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord())
06:59:18.347881 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = New-AzureWebSite -Name my-azure-website -Location North Europe -Slot production)
06:59:19.235932 Process logging event with task handler.
06:59:19.235932 BaseLogger.LogConsoleMessage(scope.JobId = 1ca0ac28-56bc-4bcb-8081-2b97efa19f68, message = ##[error]An error occurred while sending the request.)
更新:
在我的脑海里没有什么特别的,但只有第一个网站部署成功
我有一个构建,它使用这四个网站编译一个解决方案作为 Web 部署包
更新 2 - 它有效(有点)
好的,这可能不是“按设计”,但它有效:
- 我有四个网站 A、B、C 和 D。
- 部署 A、B、C 和 D => A 成功,B、C 和 D 失败
- 部署 B、A、C 和 D => A 和 B 成功,C 和 D 失败
- 部署 C、B、A 和 D => A、B 和 C 成功,D 失败
- 部署 D、C、B 和 A => A、B、C 和 D 成功!!!
在我看来,部署脚本只对第一个网站进行了某种神奇的配置?!?
我真的希望 MS 能找到这个错误,同时这可能会帮助其他处于相同情况的人