Sunday, September 30, 2018

AX 2012 R3 - Windows 2016 - Error during configuration of realtime service - Failed to install Windows Feature [Application-Server].


During real-time service configuration on Windows 2016, which is not supported for AX 2012 R3, we need to do some workaround to install real-time service for retail. First, we need to understand, that real-time service for retail will not get installed by AX Setup if we choose to configure also in one go. So first we need to install, and later, we need to modify according to our settings e.g. self-signed certificate thumbprint, applications names, ports, etc in rts-settings.xml located at the path: C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time Services\Tools


<?xml version="1.0" encoding="utf-8" ?>

<Settings>
  <Setting key="WebAppPoolName" value="CDXRealtimeServiceAppPool" />
  <Setting key="WebSiteName" value="CDXRealtimeServiceWebsite" />
  <Setting key="WebSiteHttpsPort" value="444" />
  <Setting key="WebSiteTcpPort" value="445" />
  <Setting key="WebApplicationName" value="CDXRealtimeService" />
  <Setting key="WebAppPoolUser" value="[domain]\administrator" />
  <Setting key="WebSiteSSLCertificateThumbprint" value="fbc9fd717ae56cd151252e815d8174d0f5a32ff7" />
  <Setting key="WebSiteSSLCertificateRootStore" value="LocalMachine" />
  <Setting key="WebSiteSSLCertificateStore" value="My" />
  <Setting key="WebApplicationServiceBinarySourceFolder" value="C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time Services\6.3" />
  <Setting key="WebApplicationAOSServer" value="DAX-Contoso@AOS60$01:2712" />
  <Setting key="WebSiteWorkingFolder" value="%SystemDrive%\inetpub\wwwroot\CDXRealtimeService" />
  <Setting key="EnableMetadataExchange" value="false" />
  <Setting key="WebApplicationWorkingFolder" value="[WebSiteWorkingFolder]\[WebApplicationName]" />
</Settings>


After amending above settings, we need to issue few commands on windows powershell by Run As Administrator in the same path:

To move to the path in power shell:

CD "C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time Services\Tools"

Then issue following two commands:

$Cred = @((New-Object System.Management.Automation.PSCredential('domain\user',(ConvertTo-SecureString 'password' -AsPlainText -Force))))

.\DeployRealtimeService.ps1 -SettingsXmlFilePath .\rts-settings.xml -TopologyXmlFilePath .\rts-topology.xml -Credentials $Cred –Verbose $true

It will throw the following error:

9/30/2018 4:55:38 PM: ############### Error occured: ###############
9/30/2018 4:55:38 PM: Failed to install Windows Feature [Application-Server].
9/30/2018 4:55:38 PM: ############### Error occured: ###############
9/30/2018 4:55:38 PM:

PSMessageDetails      :
Exception             : System.Management.Automation.RuntimeException: Failed to install Windows Feature [Application-Server].
TargetObject          : Failed to install Windows Feature [Application-Server].
CategoryInfo          : OperationStopped: (Failed to insta...cation-Server].:String) [], RuntimeException
FullyQualifiedErrorId : Failed to install Windows Feature [Application-Server].
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at Throw-Error, C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time Services\Tools\Common-Configuration.ps1: line 1057
                        at Try-AddWindowsFeature, C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time Services\Tools\Common-Web.ps1: line 415
                        at Validate-IfWindowsFeatureInstalled, C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time Services\Tools\Common-Web.ps1: line 433
                        at Validate-IfApplicationServerInstalledInServerOs, C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time Services\Tools\Common-Web.ps1: line 465
                        at Validate-WebApplicationInstallPrerequisites, C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time Services\Tools\Common-Web.ps1: line 638
                        at Install-WebApplication, C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time Services\Tools\Common-Web.ps1: line 1515
                        at <ScriptBlock>, C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time Services\Tools\DeployRealtimeService.ps1: line 200
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}




9/30/2018 4:55:38 PM: ############### Error occured: ###############
9/30/2018 4:55:38 PM: Web application management prerequisite validation failed.
9/30/2018 4:55:38 PM: ############### Error occured: ###############
9/30/2018 4:55:38 PM:

PSMessageDetails      :
Exception             : System.Management.Automation.RuntimeException: Web application management prerequisite validation failed.
TargetObject          : Web application management prerequisite validation failed.
CategoryInfo          : OperationStopped: (Web application...idation failed.:String) [], RuntimeException
FullyQualifiedErrorId : Web application management prerequisite validation failed.
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at Throw-Error, C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time Services\Tools\Common-Configuration.ps1: line 1057
                        at Validate-WebApplicationInstallPrerequisites, C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time Services\Tools\Common-Web.ps1: line 657
                        at Install-WebApplication, C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time Services\Tools\Common-Web.ps1: line 1515
                        at <ScriptBlock>, C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time Services\Tools\DeployRealtimeService.ps1: line 200
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}




9/30/2018 4:55:38 PM: ############### Error occured: ###############
9/30/2018 4:55:38 PM: Failed to install web application [CDXRealtimeService]
9/30/2018 4:55:38 PM: ############### Error occured: ###############
9/30/2018 4:55:38 PM:

PSMessageDetails      :
Exception             : System.Management.Automation.RuntimeException: Failed to install web application
                        [CDXRealtimeService]
TargetObject          : Failed to install web application [CDXRealtimeService]
CategoryInfo          : OperationStopped: (Failed to insta...ealtimeService]:String) [], RuntimeException
FullyQualifiedErrorId : Failed to install web application [CDXRealtimeService]
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at Throw-Error, C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time
                        Services\Tools\Common-Configuration.ps1: line 1057
                        at Install-WebApplication, C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time
                        Services\Tools\Common-Web.ps1: line 1526
                        at <ScriptBlock>, C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Real-time
                        Services\Tools\DeployRealtimeService.ps1: line 200
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}

The Windows Feature [Application-Server] is deprecated in Win 2016, so we need to copy and rename ServerManager.exe as ServerManagerCMD.exe located at the path: C:\Windows\System32.  Then re-issue the previous command and it will go on further and will not report the same error again.