dyn365-ce-vsts-tasks
dyn365-ce-vsts-tasks copied to clipboard
Azure DevOps pipeline task "MSCRM Package Deployer" throws always timeout exception
Hi, I've got issue with MSCRM Package Deployer. Whenever I try to deploy solutions to a new environment trough pipeline, it takes a long time and eventually it failed. After 3 attempts it is finally successful and the deploy passes. Error displayed on unsuccessful attempts:
FAILED : : ************ TimeoutException - DeleteAndPromote : Delete and Promote Solution to New version(DeleteAndPromoteSolutionRequest) |=> The request channel timed out while waiting for a reply after 00:02:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.
2020-11-02T07:12:28.1862576Z The request channel timed out while waiting for a reply after 00:02:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout. => The HTTP request to 'https://xxxxxxx-uat.crm4.dynamics.com/XRMServices/2011/Organization.svc/web?SDKClientVersion=9.0.45.2156' has exceeded the allotted timeout of 00:02:00. The time allotted to this operation may have been a portion of a longer timeout. => The operation has timed out 2020-11-02T07:12:28.1863856Z Source : mscorlib 2020-11-02T07:12:28.1864140Z Method : HandleReturnMessage 2020-11-02T07:12:28.1864671Z Date : 7:12:28 AM 2020-11-02T07:12:28.1864948Z Time : 11/2/2020 2020-11-02T07:12:28.1865848Z Error : The request channel timed out while waiting for a reply after 00:02:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.

Has anyone encountered a similar problem? I will be happy for any help :)
Hi, I have the same problem.
I have seen the MSCRMPackageDeployer.ps1 file, and It is passing the parameter timeout
& "$mscrmToolsPath\xRMCIFramework\9.0.0\DeployPackage.ps1" -CrmConnectionString $crmConnectionString -PackageName $packageName -PackageDirectory $packageDirectory -LogsDirectory $tempFolder -toolingConnectorModulePath $CrmConnectorPath -PackageDeploymentPath $PackageDeploymentPath -Timeout $pdTimeout -crmConnectionTimeout $crmConnectionTimeout -unpackFilesDirectory $unpackFilesDirectory -runtimePackageSettings $runtimePackageSettings
And, the file DeployPackage.ps1 has the parameter, with 2 minutes by default
#
# DeployPackage.ps1
#
param(
[string]$CrmConnectionString,
[string]$PackageName,
[string]$PackageDirectory,
[string]$LogsDirectory = '',
[string]$PackageDeploymentPath,
[string]$ToolingConnectorModulePath,
[string]$Timeout = '00:30:00', #optional timeout for Import-CrmPackage, default to 1 hour and 20 min. See https://technet.microsoft.com/en-us/library/dn756301.aspx
[int]$CrmConnectionTimeout = 2,
[string]$RuntimePackageSettings,
[string]$UnpackFilesDirectory
)
and
#Create Connection
$CRMConn = Get-CrmConnection -ConnectionString "$CrmConnectionString" -LogWriteDirectory "$LogsDirectory" -MaxCrmConnectionTimeOutMinutes $CrmConnectionTimeout -Verbose
#Deploy Package
$PackageParams = @{
CrmConnection = $CRMConn
PackageDirectory = "$PackageDirectory"
PackageName = $PackageName
LogWriteDirectory = "$LogsDirectory"
Timeout = $Timeout
}
if ($UnpackFilesDirectory)
{
$PackageParams.UnpackFilesDirectory = $UnpackFilesDirectory
}
if ($RuntimePackageSettings)
{
$PackageParams.RuntimePackageSettings = $RuntimePackageSettings
}
Import-CrmPackage @PackageParams -Verbose
Please, I need this
Hi, I can manage to fix it, I have to use the config UseAsyncForSolutionImport=true. This is in the file PackageDeployer.exe.config, but It only work when I use PackageDeployer.exe In task, I have to create a config file, similar to PackageDeployer.exe.config, with only appSettings tag
<?xml version="1.0"?> <configuration> <appSettings> <add key="numberofinputthreads" value="5" /> <add key="ClientSettingsProvider.ServiceUri" value="" /> <add key="DefaultPackageDeployerCultureName" value="en-US"/> <add key="MaxCrmConnectionTimeOutMinutes" value="240"/> <add key="UseAsyncForSolutionImport" value="true"/> <add key="SolutionStatusPollingFrequencyOverride" value="20"/> <add key="SolutionImportBlockedRetryCountOverride" value="50"/> <add key="SolutionImportBlockedWaitOverride" value="120"/> <add key="StaleImportProgressOverride" value="1000"/> </appSettings> </configuration>
Netx, I have modifyed the file "C:\vsts-agent_work_tasks\MSCRMPackageDeployer_f41ba110-0b12-45bc-94c9-67655cb59323\12.0.8\MSCRMPackageDeployer.ps1" adding this lines
[appdomain]::CurrentDomain.SetData("APP_CONFIG_FILE", $packageDirectory + "\PackageDeployer.PowerShell.config") [Configuration.ConfigurationManager].GetField("s_initState", "NonPublic, Static").SetValue($null, 0) [Configuration.ConfigurationManager].GetField("s_configSystem", "NonPublic, Static").SetValue($null, $null) ([Configuration.ConfigurationManager].Assembly.GetTypes() | where {$_.FullName -eq "System.Configuration.ClientConfigPaths"})[0].GetField("s_current", "NonPublic, Static").SetValue($null, $null)
This load the config to the execution of the powershell.
It would be util to add this config as parameter to the task
@dga205 thanks for sharing this.
What type of parameter do you suggest to add to the task? A path to a config file that contains some additional settings?
@dga205 It's possible to set this in the importconfig.xml on the configsolutionfile node by setting the requiredimportmode attribute to async.