Dynamics AX 2012 WCF服务错误

时间:2016-08-29 14:22:35

标签: wcf ssl axapta wshttpbinding aif

我在使用自定义 AX 2012 R3 CU9 AIF WCF服务时遇到了一个非常奇怪的问题。

我的目标是使用我的AX wcf服务,启用wsHttpBinding + Basic身份验证+ TransactionFlow。

每次我尝试在VS中添加此服务的服务引用时都会出现此错误\在浏览器中打开服务链接:

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:

  • 仅启用匿名和基本身份验证
  • 创建自签名证书并将其添加到主机上的服务器证书,“受信任的根证书颁发机构”和“企业信任”文件夹
  • 使用此证书在此网站上启用https绑定
  • 在网站
  • 上选中“需要SSL”选项

AX:

  • HTTP入站端口
  • 使用“配置AOS”代替“配置”选项
  • 将wsHttpBinding与Transport安全性和使用 TransportClientCredentialType = Basic

AX生成的Web配置(aos.config):

<?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>

可能会发生什么?

任何帮助都将受到高度赞赏。 谢谢。

0 个答案:

没有答案