0

I'm facing a very strange issue with a custom AX 2012 R3 CU9 AIF WCF service.

My goal is to use my AX wcf service with wsHttpBinding + Basic authentication + TransactionFlow enabled.

This error occurs every time I try to add a service reference for this service in VS \ open a service link in a browser:

Object Server 01:  An error has occurred in the services framework.  Method: AifMessageInspector::AfterReceiveRequest.  Error: System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Dynamics.Ax.Services.AxServiceOperationContext.InitializeSession()
   at Microsoft.Dynamics.Ax.Services.AxServiceOperationContext.InitializeContext()
   at Microsoft.Dynamics.Ax.Services.AxServiceOperationContext.Attach(OperationContext owner)
   at System.ServiceModel.ExtensionCollection`1.InsertItem(Int32 index, IExtension`1 item)
   at System.Collections.Generic.SynchronizedCollection`1.Add(T item)
   at Microsoft.Dynamics.Ax.Services.AifMessageInspector.AfterReceiveRequest(Message& request, IClientChannel channel, InstanceContext instanceContext) 

IIS:

  • Enabled only Anonymous and Basic authentication
  • Created self-signed certificate and added it to Server certificates on the host, "Trusted Root Certification Authorities" and "Enterprise Trust" folders
  • Enabled https binding on this web-site with this certificate
  • Checked "Require SSL" option on the web-site

AX:

  • HTTP inbound port
  • Use 'Configure AOS' instead of 'Configure' option
  • Use wsHttpBinding with Transport security and TransportClientCredentialType = Basic

Web config (aos.config) that AX generates:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.diagnostics />
 <system.serviceModel>
        <diagnostics>
   <messageLogging logEntireMessage="true" logKnownPii="true" logMalformedMessages="true"
    logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
   <endToEndTracing propagateActivity="true" activityTracing="true"
    messageFlowTracing="true" />
  </diagnostics>
  <bindings>
   <wsHttpBinding>
    <binding name="wsHttpBindingTransportBasic" transactionFlow="true">
     <security mode="Transport">
      <transport clientCredentialType="Basic" />
     </security>
    </binding>
   </wsHttpBinding>
  </bindings>
        <behaviors>
   <serviceBehaviors>
    <behavior name="DefaultServiceGroupBehavior">
     <serviceMetadata httpGetEnabled="false" httpGetUrl="http://ax2012r2a/MicrosoftDynamicsAXAif60/WCFService/xppservice.svc"
      httpsGetEnabled="true" httpsGetUrl="https://ax2012r2a/MicrosoftDynamicsAXAif60/WCFService/xppservice.svc" />
     <serviceDebug includeExceptionDetailInFaults="true" />
     <serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="200"
      maxConcurrentInstances="200" />
     <useRequestHeadersForMetadataAddress />
    </behavior>
   </serviceBehaviors>
  </behaviors>
        <services>
   <service behaviorConfiguration="DefaultServiceGroupBehavior"
    name="Microsoft.Dynamics.Ax.Services.WCFService">
    <endpoint address="https://ax2012r2a/MicrosoftDynamicsAXAif60/WCFService/xppservice.svc"
     binding="wsHttpBinding" bindingConfiguration="wsHttpBindingTransportBasic"
     name="DefaultServiceGroupEndPoint" contract="Microsoft.Dynamics.Ax.Services.ServiceGroup" />
   </service>
  </services>
        <client>
   <endpoint address="https://ax2012r2a/MicrosoftDynamicsAXAif60/WCFService/xppservice.svc"
    binding="wsHttpBinding" bindingConfiguration="wsHttpBindingTransportBasic"
    contract="*" name="DefaultServiceGroupEndPoint" />
  </client>
    </system.serviceModel>
</configuration>

What could be happening?

Any help would be highly appreciated. Thank you.

Jonathan Bravetti
  • 2,228
  • 2
  • 15
  • 29

0 Answers0