Andrew Beal
Andrew Beal

Reputation: 427

Error when deploying web application using TFS Release Managment

I am currently setting up TFS release management using vNext template at work and running into an error when I re-deploying the application. If I remove the application from the server, it deploys without any error.

After a bit of investigation, I have narrowed it down to the xWebApplication that is causing it but I am unable to fix the issue.

I have simplified my deployment script to just copy the file and creating web application:

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  

and am getting the following error:

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)

Upvotes: 1

Views: 1983

Answers (1)

You will not be able to deploy over the top with xWebApplication as It tries to create the same web application. You should delete the web application, even if you leave the files, before you try to deploy again.

Upvotes: 1

Related Questions