Web Services 使用AIF Web服务连接到Microsoft Dynamics AX 2009

plupiseo  于 2022-11-15  发布在  其他
关注(0)|答案(2)|浏览(157)

我正在使用AIF Web服务连接到Microsoft Dynamics AX 2009。VS2010中为该服务生成了代理,但当我想使用生成客户端类连接到该服务时,系统似乎没有对我进行身份验证。
我甚至尝试添加域用户/密码并使用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中指定的同一帐户运行。
应用程序连接到Web服务时出现以下错误:

System.ServiceModel.FaultException: You cannot log on to Microsoft Dynamics AX.. Error details: Unable to log on to Microsoft Dynamics AX.. Check the Web server event viewer for more information, or contact your Administrator.

Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
ubof19bj

ubof19bj1#

您无法登录到Microsoft Dynamics AX.有关详细信息,请查看Web服务器事件查看器,或与管理员联系.
也许您尚未创建为AX用户?
同时检查管理\设置\安全\系统服务帐户,尤其是“业务连接器代理”。
如果全部失败,请检查Web服务器的日志或与系统管理员联系:-)

laik7k3q

laik7k3q2#

请尝试以下操作

AX ax = new AX();//where AX=YourWebServiceClient

        ax.ChannelFactory.Credentials.UserName.UserName = @"domain\username";
        ax.ChannelFactory.Credentials.UserName.Password = @"password";

        CallContext context = new CallContext();
        context.Company = "YourCompany";

        Console.WriteLine(ax.YourServiceFunction(context));

相关问题