AX 2012 R3 CU8: System.ServiceModel.FaultException

2019-08-10 09:48发布

问题:

I'm trying to update an existing sales order using AIF services. When I invoke the service operation, I get the following error message:

System.ServiceModel.FaultException: An error occurred.

Server stack trace: at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) 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]:

The client is a VisualStudio .net C# console project. The call is wrapped in a try/catch block.

        try
        {

            Console.WriteLine("Making call to update sales order...");
            proxy.update(callContext, entityKeys, newSalesOrderDoc);
            Console.WriteLine("Updates completed successfully.");
            proxy.Close();

        }
        catch (FaultException<AifFault> e)
        {
            foreach (var item in e.Detail.InfologMessageList)
            {
                Console.WriteLine(item.InfologMessageType + " -- " + item.Message);
            }
            proxy.Abort();
        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
            proxy.Abort();
        }

I've set a breakpoint on the first catch, but execution never stops there. I'm able to invoke other operations on the inbound port without a problem.

Is there any way to get additional information?

Thanks.

回答1:

Check AIF Exceptions in the AX (System administration - Periodic - Services and Application Integration Framework - Exceptions).

You can also enable message logging on the Inbound port (under Troubleshotting select All document versions) and Include exceptions in fault. Don't forget to disable in production or periodic cleanup.