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)

Business connector InvalidLogonInSingleSessionException

(0) ShareShare
ReportReport
Posted on by

Hello,

I am working on an integration project (AX and third party shipping software).

This shipping software has an API based on the WCF service.

For some reasons (nested classes and etc.) I developed ‘wrapper’ library in C# and deployed it to AX.

This works good both on the AOS and client, however there is one issue:

To avoid a hard-code, I decided to create a parameters table in AX and get some values from there through Business connector. This approach did not work and I was getting “InvalidLogonInSingleSessionException” every time. Nevertheless the same code works perfectly in a separate application (for instance console app). My understanding is that it is because my assembly is loading by AOS or AX client, and should be another way to access the AX tables. Unfortunately, I did not find the answer anywhere, even in Microsoft.Dynamics.BusinessConnectorNet library itself.

Then I used to add the AX table directly to my library project, but it works only on the client. In any case, I personally dislike this solution.

So the question is: how to log in and access the data in AX from .NET library that has already been loaded by AOS?

I am newbie in AX and in development in general, so I really want to know what I did wrong.

Any help will be appreciated.

Thanks

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    Are you aware of Proxy Classes for .NET Interop to X++?

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

    Alternatively, redesign your solution and set the values to your library from AX, rather then allowing the library to send requests back to AX.

  • Community Member Profile Picture
    on at

    Interop works on the client only. Most probably this is beacuse Microsoft.Dynamics.Ax.ManagedInterop has x86 architecture. I would like my code to run on the AOS as well.

  • Community Member Profile Picture
    on at

    I did as you suggested. I think this is the right solution. Thank you very much Martin!

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

    Proxy class work on AOS just fine; I use them quite often. Maybe you tried to them in a wrong way.

  • Community Member Profile Picture
    on at

    Hi Martin ,

    I am also having same issue but not getting or not able to understand your reply on above

    here I am sending you error message and code ... I am getting error on session.Logon line

    request you kindly suggest....

    An exception of type 'Microsoft.Dynamics.AX.ManagedInterop.InvalidLogonInSingleSessionException' occurred in Microsoft.Dynamics.AX.ManagedInterop.dll but was not handled in user code

    public Boolean CheckConnection(string _aos)

           {

               Boolean ret;

               using (Microsoft.Dynamics.AX.ManagedInterop.Session session = new Microsoft.Dynamics.AX.ManagedInterop.Session())

               {

                   session.Logon(null, null, _aos, null);      // getting error Microsoft.Dynamics.AX.ManagedInterop.InvalidLogonInSingleSessionException

                   ClassABCdata class1 = new ClassABCdata();

                   string accountNum = "Cust001";

                   string dataAreaId = "XXX";

                   ret= class1.ifCustExists(accountNum, dataAreaId);  

                 // In AX classABCdata we have method ifCustexits

               }

               return ret;

           }

    same coding running fine on C# consol

    Thanks

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

    You didn't tell us where you're using your code. Please start with explaining what exactly you're trying to achieve. If it's not the same as discussed above, it likely doesn't belong to this thread and you should create a new one.

  • Community Member Profile Picture
    on at

    Hi Martin,

    Its same one ,

    I want to connect two AX , say AX 1 or AX 2 both having same domain but on different ports ,

    I was trying to write a C# class and calling it from AX 1 to connect AX 2 above code is fine when I tried it on C # Console,in console I m passing AOSName and PortNumber it gets connected to both AX 1 and AX2 successfully and gives the output

    now when same C# class dll , I called inside AX 1 to connected AX2 it gives InvalidLogonInSingleSessionException, as in code you can see I am passing aos name with port number as string

    its same problem which tariel was facing....

    I know web services could help me in that but what if I want to make it as configurable

    i.e from AX 1 I want to connect Ax 2 tomorrow AX 3....

    by making it configurable AOS and port name it could be possible but not sure in case of web services , that could lead code change every time (do Add reference etc..)

    So my main problem  is C# console gives correct output and working fine but same class giving InvalidLogonInSingleSessionException error when try from AX....

    what code change I need to do... any suggestion....

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

    Then it's a different problem - the answer above doesn't apply to you because you're solving a different problem.

    I tried to split this thread, so we could discuss your problem separately, unfortunately I'm getting an error.

    What I would strongly suggest is not using Business Connector at all. Use a web service instead. Then we don't have to discuss how to call Business Connector correctly in your scenario. Business Connector has many problems and isn't supported in the latest version of AX, therefore using it for new solution doesn't look wise.

    If you have a problem with configuration of web service, please create new thread and explain your problem there. If all what you want to know is how to change web service addresses from code, search this forum. I was explaining it a few weeks ago.

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