Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 发布管理vNext组件部署瓶颈_Powershell_Powershell Remoting_Ms Release Management - Fatal编程技术网

Powershell 发布管理vNext组件部署瓶颈

Powershell 发布管理vNext组件部署瓶颈,powershell,powershell-remoting,ms-release-management,Powershell,Powershell Remoting,Ms Release Management,我们将发布管理2015与vNext发布模板一起使用。对于应用程序的每个部分,我们都有一个基于Powershell DSC的组件部署,事实上,我们有两个不同的应用程序正在部署,它们处于活动开发中,并且通常几乎同时部署 在部署过程中,我们经常会遇到以下错误: OperationFailedException:不允许进行新部署,因为正在进行另一个部署。稍后重试部署 完整堆栈跟踪显示错误不是来自Powershell本身,而是来自负责在目标计算机上执行Powershell脚本的版本管理系统: System

我们将发布管理2015与vNext发布模板一起使用。对于应用程序的每个部分,我们都有一个基于Powershell DSC的组件部署,事实上,我们有两个不同的应用程序正在部署,它们处于活动开发中,并且通常几乎同时部署

在部署过程中,我们经常会遇到以下错误:

OperationFailedException:不允许进行新部署,因为正在进行另一个部署。稍后重试部署

完整堆栈跟踪显示错误不是来自Powershell本身,而是来自负责在目标计算机上执行Powershell脚本的版本管理系统:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.TeamFoundation.Release.Common.Helpers.OperationFailedException: New deployment is not allowed as an another deployment is in progress. Retry the deployment after sometime.
   at Microsoft.TeamFoundation.Release.EnvironmentProvider.OnPrem.Implementation.OnPremDeploymentProvider.ReadDeploymentResponse(DeploymentResponse response)
   at Microsoft.TeamFoundation.Release.EnvironmentProvider.OnPrem.Implementation.OnPremDeploymentProvider.RunScript(String scriptPath, String configurationPath, MachineSpecification machine, StorageSpecification storage, Dictionary`2 configurationVariables)
   at Microsoft.TeamFoundation.Release.MonitorServices.Dsc.OnPrem.OnPremDeploymentActions.InvokePlatform(String activityId, MachineSpecification machineSpecification, StorageSpecification storageSpecification, String scriptPath, String configurationPath, Dictionary`2 configurationVariables)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.Dsc.DscComponentInstaller.InvokeMethodByReflection(String methodArguments)
上面的错误导致整个部署失败,我们被迫重试该阶段或整个部署以使其完成

有两种情况会导致这种情况:

  • 两个发布模板同时在同一目标服务器上执行其powershell脚本
  • 单个发布模板有一个并行控制流,其中包含两个不同的组件,这两个组件都在同一个目标服务器上执行脚本
  • 换句话说,Release Management用于在远程服务器上执行powershell脚本的机制似乎一次只能执行一个脚本,并且无法等待/等待其他脚本完成

    如果所讨论的脚本正在修改它正在执行的服务器,那么这种类型/排序是有意义的,但是在我们的例子中,服务器基本上充当运行脚本的暂存区域。脚本的“真实”目标与执行powershell的服务器无关


    除了每个同时部署的组件都有一个服务器(wow),这里的工作是什么?这似乎是一个重大的疏忽,它严重地让我考虑完全放弃发布管理。

    < P>我在远程服务器上运行PuxScript脚本时遇到了一个问题。我最终选择了一条稍微不同的路线。相反,我只是使用
    Invoke命令
    块运行一个普通的Powershell命令。我相信你应该能够并行运行

    Function Get-PSCredential($User,$Password) {
        $SecPass = ConvertTo-SecureString -AsPlainText -String $Password -Force
        $Creds = New-Object System.Management.Automation.PSCredential -ArgumentList $User,$SecPass
        Return $Creds
    }    
    
    $credential = Get-PSCredential -User $deployUser -Password $deployPass
    $session = New-PSSession YourServerName -Credential $credential
    
    Invoke-Command -Session $session -ScriptBlock {
        # do your work here
    }
    
    如果您是作为一个可以访问机器的服务帐户运行的,那么您应该能够消除凭证内容,只需继续

    $session = New-PSSession YourServerName
    
    我本周才开始使用发布管理,所以这似乎是在这么短的时间内最好的方法

    另外,如果您以前从未使用过
    Invoke命令
    ,那么脚本块中的所有内容实际上都在它自己的范围内,因此您需要使用
    -ArgumentList
    将变量传递给它(如果有的话)。如果您对此还有任何疑问,请参阅本文。

    正如我今天所解释的,MS Release Management的部署方式有点违反直觉:它使用PSRemoting而不仅仅是对目标服务器执行Powershell部署脚本,而是使用PSRemoting来安装Windows服务(
    VisualStudioRemoteDeployer.exe
    )在目标服务器上。然后,此服务在本地运行部署脚本,MSRM服务器定期轮询此Windows服务(请参阅),以查看其是否已完成部署

    我怀疑这种奇怪的设置与避免-有关,因此它允许您的脚本从目标服务器到另一个服务器进行第二次跳转,例如Web服务调用

    无论如何,这个Windows服务可能会形成瓶颈,因为每台服务器只能运行一个这样的实例——因此,将组件并行部署到同一台服务器似乎会发生冲突

    我认为您的问题源于这样一个事实,即您选择的设置“服务器基本上充当了运行脚本的暂存区域”-MS Release Management 2013/2015在这种情况下效果不佳(如您所发现的),您应该将组件直接部署到需要安装它们的目标服务器上,从而避免临时区域瓶颈


    将使用部署代理,该代理将用作将组件部署到其他服务器的中转点。这有助于减少您在MS版本管理和目标服务器之间的防火墙上必须允许的连接数(这可能是您选择中转区域设置的原因),同时仍然允许并行(或至少排队)部署。

    我建议与产品团队@MS交谈。在这篇文章中,作者(Vijay M)谈到了发布管理并做出了回应(至少两次)我明白了。所以你认为通过显式创建新会话,我们可以避免这些问题?应该很容易测试。马上回来。;)不。问题似乎不是powershell。这是发布管理本身。对于vNext模板/组件,RM使用powershell部署一个代理,然后该代理运行组件的powershell脚本。无法运行的是此vNext代理,而不是powershell。从我们看到的堆栈跟踪可以明显看出这一点。我已经编辑了原始问题以显示完整的堆栈跟踪。在许多情况下,没有运行脚本的服务器,这也是目标。例如,我们将架构部署到SQLAzure实例。我该从哪里弄这些?这一限制可能会破坏我们的交易。我们不想运行十几个“脚本服务器”来解决这个问题。