Thursday 3 October 2013

Turn on IncludeExceptionDetailInFaults for service error in Dynamics AX

Just a quick post regarding turning on IncludeExceptionDetailInFaults for service error in Dynamics AX 2012. I'm using SOAPUI for the services testing and hit an error as below.

Error (before turn on IncludeExceptionDetailInFaults)
The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.


Turn on IncludeExceptionDetailInFaults
Identify the service you're testing, then go to the path below (replace the <ServiceName> with the service name).
C:\Program Files\Microsoft Dynamics AX\60\AifWebServices\<ServiceName>\web.config
*If you installation is not at the default location, you'll have to change the path to your installation path

Open the file and search for the text 'includeExceptionDetailInFaults', then set it to true.


Error (after turn on IncludeExceptionDetailInFaults)
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
   <s:Body> 
      <s:Fault> 
         <faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode>
         <faultstring xml:lang="en-GB">No matching MessageFilter was found for the given Message.</faultstring> 
         <detail> 
            <ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
               <HelpLink i:nil="true"/> 
               <InnerException i:nil="true"/> 
               <Message>No matching MessageFilter was found for the given Message.</Message> 
               <StackTrace>at System.ServiceModel.Routing.MessageRpc.RouteToSingleEndpoint[TContract](RoutingConfiguration routingConfig)
   at System.ServiceModel.Routing.ProcessRequestAsyncResult`1..ctor(RoutingService service, Message message, AsyncCallback callback, Object state)
   at System.ServiceModel.Routing.RoutingService.BeginProcessRequest[TContract](Message message, AsyncCallback callback, Object state)
   at System.ServiceModel.Routing.RoutingService.System.ServiceModel.Routing.IRequestReplyRouter.BeginProcessRequest(Message message, AsyncCallback callback, Object state)
   at AsyncInvokeBeginBeginProcessRequest(Object , Object[] , AsyncCallback , Object ) 
   at System.ServiceModel.Dispatcher.AsyncMethodInvoker.InvokeBegin(Object instance, Object[] inputs, AsyncCallback callback, Object state)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) 
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) 
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) 
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace> 
               <Type>System.InvalidOperationException</Type> 
            </ExceptionDetail> 
         </detail> 
      </s:Fault> 
   </s:Body> 
</s:Envelope>

1 comment:

  1. You can do this through GUI if you have the Windows SDK installed on the server.

    Deactivate your inbound port, click the Configure button. Navigate to Advanced, Service Behaviors, routingServiceBehavior, and select serviceDebug. You can flip the flag on the right-hand pane.

    ReplyDelete