Description:

We have
received some feedback from customers that inconsistence occurs when the
network connect fails during a RealTimeService operation from the POS. To
ensure that POS calls to RealTimeService is working reliable, we can enable the
reliable session in the config files. After enabling this feature, the communication
will ensure consistency in the calls.

 

NB: Enabling this feature might slightly decrease the performance.

 

Solution:

When you want to edit the Web.Config or POS.Exe.Config file it is a very good practice to
use the SvcConfigEditor.exe, which comes with the Microsoft SDK. With this tool it is very easy to see the possible values in the
different options and it provides you a good overview what is running as a service and what is running on the client.

 
 
 
  
  
  
  

To get the reliable session to work we have to change certain values.

  1. The MaxBufferSize andMaxReceivedMessageSize needs to be the same value.
  • maxBufferSize="10485760"
  • maxReceivedMessageSize="10485760" 

       2.  The values needs to be changed.

  • reliableSession ordered="true"
  • transactionFlow="true"
  • transferMode="Buffered"

 

  

Example files: Content might have to be adjusted.

POS.EXE.CONFIG file

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

<configuration>

  <configSections>

    <section name="AxRetailPOS"
type="LSRetailPosis.Settings.ConfigFile.AppConfiguration, SystemSettings,
Version=6.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

  </configSections>

  <AxRetailPOS
OfflineDatabaseConnectionString="" StoreDatabaseConnectionString="Data
Source=AX2012R2A;Initial Catalog=RetailSeattleStore;Integrated
Security=True;Persist Security
Info=False;Pooling=True;Encrypt=True;TrustServerCertificate=True"

    StoreId="SEATTLE"
TerminalId="SEATTLE-1" DATAAREAID="usrt" />

  <system.diagnostics>

    <sources>

      <!-- this registers the listener with
traces from a specific source -->

      <source
name="RetailNetTracer" switchValue="All">

        <listeners>

          <add
name="RollingXmlWriterTraceListener" />

        </listeners>

      </source>

      <source
name="RetailNetTracerEventLog" switchValue="All">

        <listeners>

          <add
name="EventLogTraceListener" />

        </listeners>

      </source>

    </sources>

    <!-- this defines a listener -->

    <sharedListeners>

      <!-- initializeData is the file
name.  If empty, it is going to be
created in %TEMP%\RetailLogs\<name of exe> -->

      <add
name="RollingXmlWriterTraceListener"

   
type="Microsoft.Dynamics.Retail.Diagnostics.RollingXmlWriterTraceListener,
Microsoft.Dynamics.Retail.Diagnostics"

     initializeData="C:\logs\pos\"

     MaxLogFileInBytes="50000000"

    traceOutputOptions="ProcessId,
DateTime, LogicalOperationStack" />

 

      <add
name="EventLogTraceListener"
type="System.Diagnostics.EventLogTraceListener"
initializeData="Dynamics AX Retail" />

    </sharedListeners>

    <!-- this configures tracing -->

    <trace autoflush="true">

      <listeners>

        <remove name="Default"
/>

        <add
name="RollingXmlWriterTraceListener" />

        <add
name="EventLogTraceListener" />

      </listeners>

    </trace>

  </system.diagnostics>

 

 
<system.serviceModel>

    <bindings>

      <netTcpBinding>

        <binding
name="TSNetTcpBinding" closeTimeout="00:01:00"
openTimeout="00:01:00"

          receiveTimeout="00:10:00"
sendTimeout="00:01:00" transactionFlow="true"

          transferMode="Buffered"
transactionProtocol="OleTransactions"

         
hostNameComparisonMode="StrongWildcard"
listenBacklog="32" maxBufferPoolSize="67108864"

          maxBufferSize="10485760"
maxConnections="16" maxReceivedMessageSize="10485760">

          <readerQuotas
maxDepth="32" maxStringContentLength="1048576"

            maxArrayLength="16384"
maxBytesPerRead="1048576" maxNameTableCharCount="16384"
/>

          <reliableSession
ordered="true" inactivityTimeout="00:10:00"

            enabled="true" />

          <security
mode="TransportWithMessageCredential">

            <transport
clientCredentialType="None"
protectionLevel="EncryptAndSign" />

            <message
clientCredentialType="UserName" algorithmSuite="Default"
/>

          </security>

        </binding>

        <binding
name="TSNetTcpBindingNoSecurity" closeTimeout="00:01:00"

          openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00"

          transactionFlow="true"
transferMode="Buffered"
transactionProtocol="OleTransactions"

         
hostNameComparisonMode="StrongWildcard"
listenBacklog="32" maxBufferPoolSize="67108864"

          maxBufferSize="10485760"
maxConnections="16" maxReceivedMessageSize="10485760">

          <readerQuotas
maxDepth="32" maxStringContentLength="1048576"

            maxArrayLength="16384"
maxBytesPerRead="1048576" maxNameTableCharCount="16384"
/>

          <reliableSession
ordered="true" inactivityTimeout="00:10:00"

            enabled="false" />

          <security
mode="None">

            <transport
clientCredentialType="None"
protectionLevel="EncryptAndSign" />

            <message
clientCredentialType="UserName" algorithmSuite="Default"
/>

          </security>

        </binding>

      </netTcpBinding>

      <wsHttpBinding>

        <binding
name="TSWsHttpBinding" closeTimeout="00:01:00"
openTimeout="00:01:00"

          receiveTimeout="00:10:00"
sendTimeout="00:01:00" bypassProxyOnLocal="false"

          transactionFlow="true"
hostNameComparisonMode="StrongWildcard"

         
maxBufferPoolSize="10485760"
maxReceivedMessageSize="1048576"

          messageEncoding="Text"
textEncoding="utf-16" useDefaultWebProxy="true"

          allowCookies="false">

          <readerQuotas
maxDepth="32" maxStringContentLength="1048576"

            maxArrayLength="16384"
maxBytesPerRead="1048576" maxNameTableCharCount="16384"
/>

          <reliableSession
ordered="true" inactivityTimeout="00:10:00"

            enabled="false" />

          <security
mode="TransportWithMessageCredential">

            <transport
clientCredentialType="None" proxyCredentialType="None"

              realm="" />

            <message
clientCredentialType="UserName"
negotiateServiceCredential="true"

             
algorithmSuite="Default" />

          </security>

        </binding>

        <binding
name="TSWsHttpBindingNoSecurity" closeTimeout="00:01:00"

          openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00"

          bypassProxyOnLocal="false"
transactionFlow="true"
hostNameComparisonMode="StrongWildcard"

         
maxBufferPoolSize="10485760"
maxReceivedMessageSize="1048576"

          messageEncoding="Text"
textEncoding="utf-16" useDefaultWebProxy="true"

          allowCookies="false">

          <readerQuotas
maxDepth="32" maxStringContentLength="1048576"

            maxArrayLength="16384"
maxBytesPerRead="1048576" maxNameTableCharCount="16384"
/>

          <reliableSession
ordered="true" inactivityTimeout="00:10:00"

            enabled="false" />

          <security
mode="None">

            <transport
clientCredentialType="None" proxyCredentialType="None"

              realm="" />

            <message
clientCredentialType="UserName"
negotiateServiceCredential="true"

             
algorithmSuite="Default" />

          </security>

        </binding>

      </wsHttpBinding>

    </bindings>

    <client>

      <endpoint address="net.tcp://hostname/RetailTransactionService/Service.svc/Common"

        binding="netTcpBinding"
bindingConfiguration="TSNetTcpBinding"

       
contract="Microsoft.Dynamics.Retail.TransactionServices.ClientProxy.ITransactionService"

        name="TSNetTcpEndpoint" />

      <endpoint
address="net.tcp://hostname/RetailTransactionService/Service.svc/Common"

        binding="netTcpBinding"
bindingConfiguration="TSNetTcpBindingNoSecurity"

       
contract="Microsoft.Dynamics.Retail.TransactionServices.ClientProxy.ITransactionService"

       
name="TSNetTcpEndpointNoSecurity" />

      <endpoint
address="https://hostname/RetailTransactionService/Service.svc/Common"

        binding="wsHttpBinding"
bindingConfiguration="TSWsHttpBinding"

       
contract="Microsoft.Dynamics.Retail.TransactionServices.ClientProxy.ITransactionService"

        name="TSWsHttpEndpoint" />

      <endpoint
address="http://hostname/RetailTransactionService/Service.svc/Common"

        binding="wsHttpBinding"
bindingConfiguration="TSWsHttpBindingNoSecurity"

       
contract="Microsoft.Dynamics.Retail.TransactionServices.ClientProxy.ITransactionService"

       
name="TSWsHttpEndpointNoSecurity" />

    </client>

  </system.serviceModel>

</configuration>

 

WEB.CONFIG FILE

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

<configuration>

  <appSettings>

    <!--AOSINSTANCE@AOSSERVER:AOSPORT-->

    <add key="ObjectServer"
value="" />

    <!--Transactoin Service AX service class
name -->

    <add
key="TransactionServiceClass"
value="RetailTransactionService" />

    <!--Transactoin Service AX service
extension class name -->

    <add
key="transactionServiceExtensionClass" value="RetailTransactionServiceEx"
/>

  </appSettings>

  <system.diagnostics>

    <sources>

      <source
name="RetailNetTracer" switchValue="Verbose">

        <listeners>

          <add
type="System.Diagnostics.DefaultTraceListener"
name="Default">

            <filter type="" />

          </add>

          <add
name="RollingXmlWriterTraceListener">

            <filter type="" />

          </add>

        </listeners>

      </source>

      <source
name="RetailNetTracerEventLog" switchValue="Verbose">

        <listeners>

          <add
type="System.Diagnostics.DefaultTraceListener"
name="Default">

            <filter type="" />

          </add>

          <add
name="EventLogTraceListener">

            <filter type="" />

          </add>

        </listeners>

      </source>

    </sources>

    <sharedListeners>

      <add
MaxLogFileInBytes="50000000"
initializeData="C:\logs\real\reallog.svclog"

       
type="Microsoft.Dynamics.Retail.Diagnostics.RollingXmlWriterTraceListener,
Microsoft.Dynamics.Retail.Diagnostics"

        name="RollingXmlWriterTraceListener"
traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId,
ThreadId, Callstack">

        <filter type="" />

      </add>

      <add initializeData="Dynamics AX
Retail" type="System.Diagnostics.EventLogTraceListener"

        name="EventLogTraceListener"
traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId,
ThreadId, Callstack">

        <filter type="" />

      </add>

    </sharedListeners>

    <trace autoflush="true">

      <listeners>

        <remove name="Default" />

        <add
name="RollingXmlWriterTraceListener">

          <filter type="" />

        </add>

        <add
name="EventLogTraceListener">

          <filter type="" />

        </add>

      </listeners>

    </trace>

  </system.diagnostics>

  <!-- When deploying the service library
project, the content of the config file must be added to the host's

  app.config file. System.Configuration does
not support config files for libraries. -->

  <system.serviceModel>

    <bindings>

      <netTcpBinding>

        <binding
name="StreamedTCPBinding" receiveTimeout="00:10:00"

          sendTimeout="00:01:00"
transferMode="Streamed" listenBacklog="32"

         
maxBufferPoolSize="67108864"
maxBufferSize="10485760" maxConnections="16"

          maxReceivedMessageSize="10485760"
portSharingEnabled="true">

          <readerQuotas
maxStringContentLength="1048576" maxBytesPerRead="1048576"
/>

          <security
mode="TransportWithMessageCredential">

            <transport
clientCredentialType="None"
protectionLevel="EncryptAndSign" />

            <message
clientCredentialType="UserName" />

          </security>

        </binding>

        <binding
name="BufferedTCPBinding" transactionFlow="true"
transferMode="Buffered"

          listenBacklog="100"
maxBufferPoolSize="67108864" maxBufferSize="10485760"

          maxConnections="16"
maxReceivedMessageSize="10485760">

          <readerQuotas
maxDepth="32" maxStringContentLength="1048576"

            maxArrayLength="16384"
maxBytesPerRead="1048576" />

          <reliableSession
enabled="true" />

          <security
mode="TransportWithMessageCredential">

            <transport
clientCredentialType="None" />

            <message
clientCredentialType="UserName" />

          </security>

        </binding>

      </netTcpBinding>

      <wsHttpBinding>

        <binding
name="wsHttpEndpointBinding" transactionFlow="true"

         
maxBufferPoolSize="10485760"
maxReceivedMessageSize="10485760"

          textEncoding="utf-16">

          <readerQuotas maxStringContentLength="1048576"
maxBytesPerRead="1048576" />

          <security
mode="TransportWithMessageCredential">

            <transport
clientCredentialType="None" />

            <message
clientCredentialType="UserName" algorithmSuite="Default"
/>

          </security>

        </binding>

      </wsHttpBinding>

    </bindings>

    <services>

      <service
behaviorConfiguration="ReleaseBehavior"
name="Microsoft.Dynamics.Retail.TransactionServices.TransactionService">

        <endpoint address="Common"
binding="netTcpBinding"
bindingConfiguration="BufferedTCPBinding"

          name="Common"
contract="Microsoft.Dynamics.Retail.TransactionServices.Contracts.ITransactionService"
/>

        <endpoint
address="SCMonitoring" binding="netTcpBinding" bindingConfiguration="BufferedTCPBinding"

          name="SCMonitoring"
contract="Microsoft.Dynamics.Retail.TransactionServices.Contracts.IStoreConnectMonitoring"
/>

      </service>

    </services>

    <behaviors>

      <serviceBehaviors>

        <behavior name="ReleaseBehavior">

          <serviceMetadata
httpGetEnabled="false" httpsGetEnabled="false" />

          <serviceCredentials>

            <serviceCertificate
findValue="6B3B49DFAD6100A47EF623C8E471C567BF052530"
storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"
/>

            <userNameAuthentication
userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="Microsoft.Dynamics.Retail.TransactionServices.Authentication,
Microsoft.Dynamics.Retail.TransactionServices" />

          </serviceCredentials>

        </behavior>

      </serviceBehaviors>

    </behaviors>

  </system.serviceModel>

</configuration>

 

NB. The next release of AX (Dynamics AX 2012 R3)
has reliable session enabled by default.

 

 

 

Author: Kim Truelsen

Date: 11/2-2014