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

发布于 2024-11-24 05:41:01 字数 1826 浏览 2 评论 0原文

我正在使用 AIF Webservices 连接到 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)

I'm using AIF webservices to connect to Microsoft Dynamics AX 2009. Proxies are generated for the service in VS2010, but when I want to connect to the service using generate client class, it seems I am not authenticated in the system.

I even tried adding a domain user/pass and use windows authentication, like this:

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);

Default binding is HttpBinding, and I'm trying to connect to the AIF using a console application that is running using the same account specified in NetworkCredential on the same machine.

I get the following error when application connects to the webservice:

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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

软糖 2024-12-01 05:41:01

您无法登录 Microsoft Dynamics AX。检查网络
服务器事件查看器了解更多信息,或联系您的
管理员。

也许您尚未创建为 AX 用户?

另请检查 Administration\Setup\Security\System 服务帐户,尤其是“业务连接器代理”。

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

You are unable to log on to Microsoft Dynamics AX. Check the Web
server event viewer for more information, or contact your
Administrator.

Maybe you do not have been created as an AX user?

Also check Administration\Setup\Security\System service accounts especially the "Business connector proxy".

If all fails, check the logs of your web server or contact your system administrator :-)

℡Ms空城旧梦 2024-12-01 05:41:01

尝试以下操作

        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));

Try the following

        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));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文