使用AIF网络服务连接到Microsoft Dynamics AX 2009



我正在使用AIF webservices连接到Microsoft Dynamics AX 2009。代理是为VS2010中的服务生成的,但是当我想使用生成客户端类连接到服务时,似乎我没有在系统中进行身份验证。

我甚至尝试添加一个域用户/pass并使用windows身份验证,像这样:

var binding = new BasicHttpBinding();
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
var address = new EndpointAddress(new Uri("http://dynamicsserver/salesorderservice.svc"));
var client = new SalesOrderServiceClient(binding, address);
client.ClientCredentials.Windows.ClientCredential = new NetworkCredential("admin", "pass", "domain);

默认绑定是HttpBinding,我正在尝试使用控制台应用程序连接到AIF,该应用程序在同一台机器上使用NetworkCredential中指定的相同帐户运行。

当应用程序连接到webservice时,我得到以下错误: <>之前System.ServiceModel.FaultException:你不能登录到Microsoft Dynamics AX..错误详细信息:无法登录到Microsoft Dynamics AX..请检查Web服务器事件查看器以获取更多信息,或与管理员联系。服务器堆栈跟踪:在System.ServiceModel.Channels.ServiceChannel。HandleReply(ProxyOperationRuntime操作,ProxyRpc&rpc)在System.ServiceModel.Channels.ServiceChannel。调用(String action, Boolean单向,ProxyOperationRuntime操作,Object[] in, Object[] outs, TimeSpan timeout)在System.ServiceModel.Channels.ServiceChannelProxy。调用方法调用方法调用,ProxyOperationRuntime操作在System.ServiceModel.Channels.ServiceChannelProxy。调用(IMessage消息)[0]异常被重新抛出:在System.Runtime.Remoting.Proxies.RealProxy。HandleReturnMessage(IMessage reqMsg, IMessage retMsg)在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (MessageData&msgData, Int32类型)

您无法登录到Microsoft Dynamics AX。浏览网页服务器事件查看器以获取更多信息,或与您的管理员。

也许您没有被创建为AX用户?

还要检查AdministrationSetupSecuritySystem服务帐户,特别是"Business connector proxy"。

如果全部失败,请检查web服务器的日志或联系系统管理员:-)

试试下面的

        AX ax = new AX();//where AX=YourWebServiceClient
        ax.ChannelFactory.Credentials.UserName.UserName = @"domainusername";
        ax.ChannelFactory.Credentials.UserName.Password = @"password";
        CallContext context = new CallContext();
        context.Company = "YourCompany";
        Console.WriteLine(ax.YourServiceFunction(context));

最新更新