Axapta Business Connector Logout problems

pedroparra
Member Posts: 58
Hi all,
I am just testing the Business Connector because I need to make a interface
of Axapta with one .NET application.
Just only I started with this code:
Module Module1
Sub Main()
Dim Axapta As AxaptaCOMConnector.Axapta
Console.WriteLine("Testing Axapta Business Connector")
Try
Axapta = New AxaptaCOMConnector.Axapta
Axapta.Logon("pedro", "", "", "axaptaConfig")
Axapta.Logoff()
Axapta = Nothing
Catch ex As System.Exception
MsgBox("Error:" + ex.ToString, MsgBoxStyle.Exclamation,
"Application Error")
End Try
Console.WriteLine("Press key to finish")
Console.ReadLine()
End Sub
End Module
The first time I execute this code the user Logon in Axapta. But when the
application exits the user is still in the Online Users of my Axapta
installation. Futhermore, if I close manually the sessión of this user and I
try to execute this small application once more I get this Exception:
System.Runtime.InteropServices.COMException (0x80020009): Exception
occurred. at AxaptaCOMConnector.AxaptaClass.Logon(...)
Then I need to manually to restart the Navision Axapta Business Connector
COM+ component service in the Components services Window of Windows.
My installation is a Axapta v3 SP3. 3-Tier.
I executed the code in my Windows XP workstation.
Any ideas?
Thanks in advance.
Pedro
I am just testing the Business Connector because I need to make a interface
of Axapta with one .NET application.
Just only I started with this code:
Module Module1
Sub Main()
Dim Axapta As AxaptaCOMConnector.Axapta
Console.WriteLine("Testing Axapta Business Connector")
Try
Axapta = New AxaptaCOMConnector.Axapta
Axapta.Logon("pedro", "", "", "axaptaConfig")
Axapta.Logoff()
Axapta = Nothing
Catch ex As System.Exception
MsgBox("Error:" + ex.ToString, MsgBoxStyle.Exclamation,
"Application Error")
End Try
Console.WriteLine("Press key to finish")
Console.ReadLine()
End Sub
End Module
The first time I execute this code the user Logon in Axapta. But when the
application exits the user is still in the Online Users of my Axapta
installation. Futhermore, if I close manually the sessión of this user and I
try to execute this small application once more I get this Exception:
System.Runtime.InteropServices.COMException (0x80020009): Exception
occurred. at AxaptaCOMConnector.AxaptaClass.Logon(...)
Then I need to manually to restart the Navision Axapta Business Connector
COM+ component service in the Components services Window of Windows.
My installation is a Axapta v3 SP3. 3-Tier.
I executed the code in my Windows XP workstation.
Any ideas?
Thanks in advance.
Pedro
0
Comments
-
Hi Pedro,
You cannot run your application once again without manually shutting down the first instance of Ax COM Connector.
This is a well known behaviour documented in AxDvgCOMUs.chm. Please search for 'AXCOM.DLL' there.
Hope this helps,Harish Mohanbabu
Long way to go before I sleep..0 -
Hi Harish,
It seem that the user created by the Business Connector wont close it session until the Business Connector DLL isnt downloaded from memory.
I have managed to solve the issue configuring to close the COM+ aplication "Navision Axapta Business Connector" after 0 minutes of innactivity (I can do this in its properties window).
Also in during the logon process the user is already logged because the DLL hasnt unloaded I can unload the Navision Axapta Business Connector with this code:COMAdmin.COMAdminCatalog comCatalog = new COMAdmin.COMAdminCatalog(); comCatalog.ShutdownApplication("Navision Axapta Business Connector"); comCatalog.StartApplication("Navision Axapta Business Connector");
For this code we need the COMAdmin.dll located at \windows\system32\com\comadmin.dll.
Thank you0 -
pedroparra wrote:Hi all,
I am just testing the Business Connector because I need to make a interface
of Axapta with one .NET application.
Just only I started with this code:
Module Module1
Sub Main()
Dim Axapta As AxaptaCOMConnector.Axapta
Console.WriteLine("Testing Axapta Business Connector")
Try
Axapta = New AxaptaCOMConnector.Axapta
Axapta.Logon("pedro", "", "", "axaptaConfig")
Axapta.Logoff()
Axapta = Nothing
Catch ex As System.Exception
MsgBox("Error:" + ex.ToString, MsgBoxStyle.Exclamation,
"Application Error")
End Try
Console.WriteLine("Press key to finish")
Console.ReadLine()
End Sub
End Module
I don't know if this will resolve anything (and my reply is certainly a little bit too late ;-) but you should really your code in order to prevent problems :Axapta.Logoff() Axapta = Nothing
must be replaced byTry ... Catch ... ... Finally Axapta.Dispose() End Try
This because the statementAxapta = Nothing
does absolutely nothing (This behaviour is very different then with VB6). When Axapta is set to nothing, the instance will not directly finalized (and so Disposed) by the GC and this latency will cause sometimes quite ugly problems. Even if this might not help you personally, this might help anybody reading this code ;-)
Cheers,
Florian0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions