使用TFS Release Managment部署Web应用程序时出错

时间:2015-06-08 15:13:31

标签: visual-studio powershell tfs tfs2013 ms-release-management

我目前正在使用vNext模板在工作中设置TFS版本管理,并在重新部署应用程序时遇到错误。如果我从服务器中删除该应用程序,它将部署而不会出现任何错误。

经过一番调查后,我已将其缩小到导致它的xWebApplication,但我无法解决问题。

我已将部署脚本简化为仅复制文件并创建Web应用程序:

Configuration AddressServiceWebsite
{
Import-DscResource -Module xWebAdministration
Import-DscResource -ModuleName xReleaseManagement

Node $AllNodes.NodeName
{
    File CopyDeploymentBits
    {
        Ensure = "Present"
        Type = "Directory"
        Recurse = $true
        SourcePath = $applicationPath
        DestinationPath = $Node.DeploymentPath
    }

    xWebApplication WebApplication {
        Website = $Node.WebsiteName
        Name = $Node.ApplicationName
        WebAppPool  = $Node.ApplicationPool
        PhysicalPath = $Node.DeploymentPath
        Ensure = "Present"
    }   
}
}

AddressServiceWebsite -ConfigurationData $ConfigData -Verbose -Force  

我收到以下错误:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AggregateException: One or more errors occurred. ---> Microsoft.TeamFoundation.Release.Common.Helpers.OperationFailedException: Copying recursively from \\whds001\tfs\Builds\Direct\SOA\AddressService\PR000081 to C:\Windows\DtlDownloads\AddressService succeeded.

System.AggregateException: Failed to apply configuration in the DSC script to the computer. Consult the Logs below for details of the error.

Destination element already exists, please use "force" parameter to override.
 CategoryInfo :InvalidArgument: (:) [], CimException
 FullyQualifiedErrorId :Destination element already exists, please use "force" parameter to override.,Microsoft.IIs.PowerShell.Provider.NewWebApplicationCommand

The PowerShell provider MSFT_xWebApplication threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
 CategoryInfo :InvalidOperation: (:) [], CimException
 FullyQualifiedErrorId :NonTerminatingErrorFromProvider

The SendConfigurationApply function did not succeed.
 CategoryInfo :NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
 FullyQualifiedErrorId :MI RESULT 1
 ---> Microsoft.Management.Infrastructure.CimException: Destination element already exists, please use "force" parameter to override.
   --- End of inner exception stack trace ---
   at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.PowershellExecutor.Invoke(String errorContextMessage, Boolean writeResultToLog, Boolean isCancellable)
   at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Utilities.RetryExecutor.Execute(Action action)
   at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.DeploymentService.RunPowerShellScripts(DeploymentMachineSpecification deploymentMachine, ScriptSpecification scriptSpecification, ScriptSpecification initializationScriptSpecification, String applicationPath, IPowerShell powerShellSession)
---> (Inner Exception #0) Microsoft.Management.Infrastructure.CimException: Destination element already exists, please use "force" parameter to override.<---

---> (Inner Exception #1) Microsoft.Management.Infrastructure.CimException: The PowerShell provider MSFT_xWebApplication threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.<---

---> (Inner Exception #2) Microsoft.Management.Infrastructure.CimException: The SendConfigurationApply function did not succeed.
   at Microsoft.Management.Infrastructure.Internal.Operations.CimAsyncObserverProxyBase`1.ProcessNativeCallback(OperationCallbackProcessingContext callbackProcessingContext, T currentItem, Boolean moreResults, MiResult operationResult, String errorMessage, InstanceHandle errorDetailsHandle)<---
Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.

An LCM method call arrived from computer WHWA041 with user sid S-1-5-21-12480674-1100442233-928725530-45419.

[WHWA041]: LCM:  [ Start  Set      ]

[WHWA041]: LCM:  [ Start  Resource ]  [[File]CopyDeploymentBits]

[WHWA041]: LCM:  [ Start  Test     ]  [[File]CopyDeploymentBits]

[WHWA041]:                            [[File]CopyDeploymentBits] Building file list from cache.

[WHWA041]: LCM:  [ End    Test     ]  [[File]CopyDeploymentBits]  in 0.0460 seconds.

[WHWA041]: LCM:  [ Start  Set      ]  [[File]CopyDeploymentBits]

[WHWA041]:                            [[File]CopyDeploymentBits] Building file list from cache.

[WHWA041]:                            [[File]CopyDeploymentBits] The destination object was found and no action is required.

[WHWA041]: LCM:  [ End    Set      ]  [[File]CopyDeploymentBits]  in 0.0470 seconds.

[WHWA041]: LCM:  [ End    Resource ]  [[File]CopyDeploymentBits]

[WHWA041]: LCM:  [ Start  Resource ]  [[xWebApplication]WebApplication]

[WHWA041]: LCM:  [ Start  Test     ]  [[xWebApplication]WebApplication]

[WHWA041]:                            [[xWebApplication]WebApplication] Checking whether WebAdministration is there in the machine or not.

[WHWA041]: LCM:  [ End    Test     ]  [[xWebApplication]WebApplication]  in 0.9980 seconds.

[WHWA041]: LCM:  [ Start  Set      ]  [[xWebApplication]WebApplication]

[WHWA041]:                            [[xWebApplication]WebApplication] Checking whether WebAdministration is there in the machine or not.

[WHWA041]: LCM:  [ End    Set      ]  [[xWebApplication]WebApplication]  in 0.9990 seconds.

[WHWA041]: LCM:  [ End    Set      ]

Operation 'Invoke CimMethod' complete.

Time taken for configuration job to complete is 2.292 seconds


   at Microsoft.TeamFoundation.Release.EnvironmentProvider.OnPrem.Implementation.OnPremDeploymentProvider.ReadDeploymentResponse(DeploymentResponse response)
   at Microsoft.TeamFoundation.Release.EnvironmentProvider.OnPrem.Implementation.OnPremDeploymentProvider.<RunPowerShellScript>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.TeamFoundation.Release.EnvironmentProvider.OnPrem.Implementation.OnPremDeploymentProvider.<RunScript>d__0.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Microsoft.TeamFoundation.Release.MonitorServices.Dsc.OnPrem.OnPremDeploymentActions.InvokePlatform(String activityId, MachineSpecification machineSpecification, StorageSpecification storageSpecification, String scriptPath, String configurationPath, Dictionary`2 configurationVariables)
   at Microsoft.TeamFoundation.Release.MonitorServices.Dsc.OnPrem.OnPremDeploymentActions.RunScript(DscComponent dscComponentParameters, String serverName, String userName, String password, String componentName, String scriptPath, String configurationPath, String useCredSecuritySupportProvider, String useHttps, String skipCACheck)
   --- 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)

1 个答案:

答案 0 :(得分:1)

您将无法使用xWebApplication在顶部进行部署,因为它会尝试创建相同的Web应用程序。在尝试再次部署之前,您应该删除Web应用程序,即使您保留文件也是如此。