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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

C# -> AX, How do I switch which aos the visual studio project is pointed to?

(0) ShareShare
ReportReport
Posted on by 1,871

I am working on directly integrating the AX customer list (CustTable) into a standalone application within C#. However whenever I did this I had it pointed to my DEV AOS. How do I go about changing which aos it is pulling its data from?

I've tried loading my other environments config file for visual studio (devenv.exe /AXConfig <config file>.axc) but that did nothing. I also tried removing my table proxies and re-adding them while connected to my other AOS from within visual studio. I tried running a grep on all the files within my project folder but it doesn't even find the aos name in any of the files.

Is there is a way to manually (via code) point it to a specific config file or aos server? If not is there even a way to repoint the project to another aos through the VS IDE?

*This post is locked for comments

I have the same question (0)
  • Ivan (Vanya) Kashperuk Profile Picture
    on at

    Have you read this?

    msdn.microsoft.com/.../gg889291.aspx

  • adam260 Profile Picture
    1,871 on at

    Yes this is what I was referring to when I mentioned

    "I've tried loading my other environments config file for visual studio (devenv.exe /AXConfig <config file>.axc) but that did nothing"

  • Verified answer
    adam260 Profile Picture
    1,871 on at

    Ah ok I figured it out. On all the examples on the net that I found (including msdn) in order to log onto AX via C# you use the following code...

    Session axSession = new Session();

    axSession.Logon(null, null, null, null);

    However to specify which aos you want you need to do the following

    Session axSession = new Session();

    axSession.Logon(null, null, "AOSServerNameToPullFrom", null);

    so it goes

    axSession.Logon(<company>, <language>, <aos server>, <configuration file>);

    so by using the parm <aos server> I can define directly the name of the server or defined a file path of the config file(.axc) via <configuration file> parm

  • Verified answer
    Tommy Skaue Profile Picture
    Moderator on at

    If you do not want to hardcode this in your code, you should consider configuring this using the normal flow on how a program access a specific AOS.

    By default, any program will connect to the very first configuration being installed on a machine. So the first time AX setup installs any program that needs information about where to find an AOS (like installing the AX client), setup will ask the name of the server, the TCP and WSDL port. Any other user later on "adopts" these default settings.

    The next level of configuration is under Control Panel and administrative tools. Here you can change preferred AOS for your user AND the .Net Business Connector (if applicable).

    The third level is providing an AX Configuration file when executing a program, either the AX client or some custom program.

    Fourth, you can create your own custom configuration schema and load the values into your program.

  • adam260 Profile Picture
    1,871 on at

    Thanks for the suggestions Tommy. I figured something like that was going on. However what surprised me was whenever I changed the default config under Control Panel>Admin tools it didn't reflect the change within the application (custom app, not AX). Which is leading me down the path of hard coding the server/pointing to a config file.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans