Sunday, September 30, 2018

AX 2012 - Multiple AOS Scenario - No connection could be made because the target machine actively refused it :8201

On multiple AOS deployments you may encounter an issue:

Multiple AOS Scenario - No connection could be made because the target machine actively refused it <ip-address>:8201

On Event Viewer check, it appears to be a wrong services port being called by reports in AX, the main error was "Could not connect to net.tcp://<machine-name>:8201/DynamicsAx/Services/MetadataService". The detail event log is as follows:


An error has occurred during report processing. (rsProcessingAborted)

An error has occurred during report processing. (rsProcessingAborted)

Microsoft.Reporting.WinForms.ReportServerException
   at Microsoft.Reporting.WinForms.ServerReport.ServerUrlRequest(Boolean isAbortable, String url, Stream outputStream, String& mimeType, String& fileNameExtension)
   at Microsoft.Reporting.WinForms.ServerReport.InternalRender(Boolean isAbortable, String format, String deviceInfo, NameValueCollection urlAccessParameters, Stream reportStream, String& mimeType, String& fileNameExtension)
   at Microsoft.Reporting.WinForms.AsyncMainStreamRenderingOperation.RenderServerReport(ServerReport report)
   at Microsoft.Reporting.WinForms.AsyncRenderingOperation.PerformOperation()
   at Microsoft.Reporting.WinForms.ReportViewer.AsyncReportOperationWrapper.PerformOperation()
   at Microsoft.Reporting.WinForms.ProcessingThread.ProcessThreadMain(Object arg)

Query execution failed for dataset 'CustBaseData'. (rsErrorExecutingCommand)

Microsoft.Reporting.WinForms.ReportServerException


Exception occurred on the metadata service on client or server. See exception details below:
>Could not connect to net.tcp://<machine-name>:8201/DynamicsAx/Services/MetadataService. The connection attempt lasted for a time span of 00:00:03.0784815. TCP error code 10061: No connection could be made because the target machine actively refused it <Ip address>:8201.

Microsoft.Reporting.WinForms.ReportServerException


Could not connect to net.tcp://<machine-name>:8201/DynamicsAx/Services/MetadataService. The connection attempt lasted for a time span of 00:00:03.0784815. TCP error code 10061: No connection could be made because the target machine actively refused it <Ip address>:8201.

Microsoft.Reporting.WinForms.ReportServerException


No connection could be made because the target machine actively refused it <Ip address>:8201

Microsoft.Reporting.WinForms.ReportServerException
In order to resolve this error, you need to open/investigate Ax32Serv.exe.config configuration file with AOS and correct services port entry. The file you can find in the path, C:\Program Files\Microsoft Dynamics AX\60\Server\[AOS-Server-Instance]\bin.

It was obvious, in the configuration file, in beginning that Services port was 8202, but at the bottom of the same file, it was referred to as 8201, which was wrong and needed to be corrected.

Actual ports settings:

  <appSettings>
    <add key="ODataQueryPageSize" value="1000" />
    <add key="ServicePort" value="8202" />
    <add key="WsdlPort" value="8102" />
  </appSettings>

Wrong Port entries at the bottom of Ax32Serv.exe.config configuration file:

    <client>
      <endpoint address="net.tcp://localhost:8201/DynamicsAx/Services/AxClient" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_SysWorkflowConfigurationService" contract="Microsoft.Dynamics.AX.Framework.Services.Client.AxClient.SysWorkflowConfigurationService" name="NetTcpBinding_SysWorkflowConfigurationService">
      </endpoint>
      <endpoint address="net.tcp://localhost:8201/DynamicsAx/Services/MetadataService" binding="netTcpBinding" bindingConfiguration="MetadataServiceBinding" contract="Microsoft.Dynamics.AX.Framework.Services.Metadata.Service.IAxMetadataService" name="MetadataServiceEndpoint">
      </endpoint>
      <endpoint address="net.tcp://localhost:8201/DynamicsAx/Services/QueryService" binding="netTcpBinding" bindingConfiguration="QueryServiceBinding" contract="Microsoft.Dynamics.AX.Framework.Services.QueryService.IQueryService" name="QueryServiceEndpoint">
      </endpoint>
    </client>

Rectifying the port from 8201 to 8202, and restarting AOS to take new changes into effect, will fix the issue. However, if this still shows up, the Usage data in User's option can be Reset, and report is successfully run afterwards. This one is tried and tested successfully.