我在使用自定义AX 2012 R3 CU9 AIF WCF 服务时遇到了一个非常奇怪的问题。
我的目标是在启用 wsHttpBinding + 基本身份验证 + TransactionFlow 的情况下使用我的 AX wcf 服务。
每次我尝试在 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”选项
斧头:
- HTTP 入站端口
- 使用“配置 AOS”而不是“配置”选项
- 将 wsHttpBinding 与传输安全性和 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>
会发生什么?
任何帮助将不胜感激。谢谢你。