web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to connect to dynamics ax from user machine

(0) ShareShare
ReportReport
Posted on by

I am very new to dynamics AX. I have deployed dynamics ax 2012 r3 as given in this link (https://ax.help.dynamics.com/en/wiki/deploy-an-ax-2012-r3-or-ax-2012-r3-cu8-demo-environment-on-azure/). I am able to connect to it from the same machine where dynamics ax instance exists. i used following code

 Microsoft.Dynamics.BusinessConnectorNet.Axapta DynAx = new
                Microsoft.Dynamics.BusinessConnectorNet.Axapta();
            Microsoft.Dynamics.BusinessConnectorNet.AxaptaRecord DynRec;
            try
            {
                // Authenticate the user and establish a session.
                DynAx.Logon(null, null, null, null);

                // Define the record as the CustTrans table.
                DynRec = DynAx.CreateAxaptaRecord("CustTrans");

                // Define the query that will run on the CustTrans records.
                // This will return all the data in the CustTrans table with 
                // the cursor positioned at the first record in the table.
                DynRec.ExecuteStmt("select * from %1");

                // Check if the query returned any data.
                if (DynRec.Found)
                {
                    // Display the record on the form that was retrieved from the query.
                    textBox1.Text = (string)DynRec.get_Field("AccountNum");
                }
            }


But how can i connect to this dynamics instance from other machine? (where this instance is not installed). I want to pull data from this dynamics ax instance.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    1) User that is running application should exists in AX as a user, if your one does not please try to use LogonAs instead.

    2) BC should be installed.

    3) try to specify AOS and path to configuration (last 2 parameters)

    4 ) refer to https://msdn.microsoft.com/en-us/library/aa548218.aspx

  • ranadheer reddy Profile Picture
    on at

    Thank you very much for the reply. Here both users are different so i tried adding proxy user in BCP. when i try to save it, its showing me following error.

    The alias/network domain entered for the Business Connector proxy is not valid.

    Any ideas on this error ?

  • ranadheer reddy Profile Picture
    on at

    Hi,

    I added proxy user in dynamics AX. I used following code to connect to AX. (as given in this link msdn.microsoft.com/.../bb986590.aspx)

    System.Net.NetworkCredential nc = new System.Net.NetworkCredential("myUserName", "password");

               string strUserName = "myUserName";

               // Test the connection to the .NET Business Connector.

               try

               {

                   DynAx.LogonAs(strUserName.Trim(), "", nc, "", "", "", "");

                   DynAx.Logoff();

               }

               catch (Exception ex)

               {

                   Console.WriteLine(ex.Message);

               }

    When i run it i am getting following error at LogonAs method

    Failed to initialize the managed interoperability layer of Microsoft Dynamics AX.

  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    You need to have business connector installed on this server as well

  • ranadheer reddy Profile Picture
    on at

    Hi,

    I copied businessconnector dll from the machine where i installed dynamics ax and added as reference to my VS project(is that what i have to do?). still facing the same error.

    I also exported axc file and added its path to logonAs method as last parameter like LogonAs("","",....."D:\Dynamics.axc");

    Do i have to specify AOS also ? if so, what should i add there ?

  • Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    Why are you building something new using the old, deprecated technology of Business Connector?

    If you use the recommended approach, web services, you'll find that it's easier to develop and debug, you don't need AX client (Bussiness Connector is basically AX client without GUI), you can connect from other machines via HTTP and so on...

    Nevertheless if you insist on Business Connector, make sure you actually install it using AX installer

  • ranadheer reddy Profile Picture
    on at

    Hi Martin,

    Thanks for your reply. For me, it's not mandatory to use business connector. I thought it is the only way to connect to dynamics ax.

    Can you please help me with the other ways to connect to dynamics ax ? any reference articles ? mean while i will also search for them.

    Regards,

    Ranadheer

  • Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
GL-01081504-0 Profile Picture

GL-01081504-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans