Friday, April 24, 2015

Retail Transaction Service Connection - Error 13010 Could not connect to the Transaction Service

The retail transaction service on the POS can get cranky at times by not being able to reach the backoffice HQ to do a specific operation. The error message for 13010 is very generic meaning there is a connection issue between POS client and Retail Transaction service. More indepth details can be found from the Event viewer log where the error arises. The current issue in discussion happened when there was a sudden failure due to Business connector for Transaction service was unable to access Dynamics AX.

There are a few possible causes for the error could be due to permissions and rights issue for the business connector service account which might have been modified by the system administrator. If that's not the case and you are sure that the service account was not changed recently then it is recommended to Reset the IIS. The IIS reset will refresh the security tokens that might have linked to the service accounts. The business connector in my case was able to successfully connect back to AX after the IIS reset and Transaction service was back to normal.

Detailed event viewer entries
LSRetailPosis.TransactionServices.InvokeMethod: System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. ---> System.ServiceModel.FaultException: An error occurred when verifying security for the message.
   --- End of inner exception stack trace ---

Server stack trace:
   at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)
   at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout)
   at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout)
   at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout)
   at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ReliableChannelBinder`1.ChannelSynchronizer.SyncWaiter.TryGetChannel()
   at System.ServiceModel.Channels.ReliableChannelBinder`1.ChannelSynchronizer.SyncWaiter.TryWait(TChannel& channel)
   at System.ServiceModel.Channels.ReliableChannelBinder`1.ChannelSynchronizer.TryGetChannel(Boolean canGetChannel, Boolean canCauseFault, TimeSpan timeout, MaskingMode maskingMode, TChannel& channel)
   at System.ServiceModel.Channels.ReliableChannelBinder`1.Send(Message message, TimeSpan timeout, MaskingMode maskingMode)
   at System.ServiceModel.Channels.SendReceiveReliableRequestor.OnRequest(Message request, TimeSpan timeout, Boolean last)
   at System.ServiceModel.Channels.ReliableRequestor.Request(TimeSpan timeout)
   at System.ServiceModel.Channels.ClientReliableSession.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ClientReliableDuplexSessionChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.Dynamics.Retail.TransactionServices.ClientProxy.ITransactionService.InvokeMethod(RequestInfo requestInfo, String methodName, Object[] parameters)
   at LSRetailPosis.TransactionServices.InvokeMethod(String methodName, Object[] parameters).

BC.Net connectivity failure.AXNET.Logon() method called with Company: null | Language: null | ObjectServer:

   at Microsoft.Dynamics.BusinessConnectorNet.Axapta.Logon(String company, String language, String objectServer, String configuration)
   at Microsoft.Dynamics.Retail.TransactionServices.AxaptaWrapper.CreateAxapta(RequestInfo info)

Axapta.Logon() failed. Exception details: Microsoft.Dynamics.AX.ManagedInterop.NoSecurityKeyException
   at Microsoft.Dynamics.BusinessConnectorNet.Axapta.Logon(String company, String language, String objectServer, String configuration)
   at Microsoft.Dynamics.Retail.TransactionServices.AxaptaWrapper.CreateAxapta(RequestInfo info)

Retail Transaction Service Error for NET.TCP

There can be situations when the real time service for a store suddenly stops working if it uses the net.tcp protocol to communicate with back office AX. You will be provided with a connection unsuccessful exception from the server due to time out. And a generic error during an operation For Eg:- Recall Sales order operation from the POS as "An error occurred while refreshing the list". A closer look at the event POS will provide insights into the net.tcp error log like below.

Microsoft.Dynamics.Retail.Pos.SalesOrder.WinFormsTouch.frmGetSalesOrder, Text: Sales orders: LSRetailPosis.PosisException ---> System.ServiceModel.EndpointNotFoundException: Could not connect to net.tcp://server.ttprod.local:8190/RealTimeService/Service.svc/Common. The connection attempt lasted for a time span of 00:00:01.0312456. TCP error code 10061: No connection could be made because the target machine actively refused it  ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
   at System.ServiceModel.Channels.SocketConnectionInitiator.Connect(Uri uri, TimeSpan timeout)

   --- End of inner exception stack trace ---

The server had actively refused the connection for net.tcp connection as the listener port was not started for the service. The listener Port for the network adapter can be activated on the server from the Services > NET.TCP Listener Adapter and starting the service.