Sorry for the delayed response on this, I have been out of town for two
weeks.
I have set up a simple C# app (cs code inlined at the bottom of this mail)
that simply connects and calls a static method. The app does not connect on
my development machine either, it produces the same error:
"at AxaptaCOMConnector.Axapta2Class.Logon2(Object user, Object userPassword,
Object Company, Object language, Object serverManager, Object objectServer,
Object configuration, Object isWebUser, Object reserved1, Object reserved2)
at AxaptaCommsTest.Form1.connect()
File Error : The application files are not accessible. This can be caused by
another Navision Axapta instance using the application files in exclusive
mode.
Navision Axapta cannot be executed. Please restart the Navision Axapta
Business Connector before logging on."
I have copied the HKEY_CURRENT_USER\Software\Navision settings to
HKEY_LOCAL_MACHINE\Software\Navision and deleted the original. This made no
difference. My testing procedure is as follows:
-Export the Axapta configuration from my machine to file.
-Import the configuration to the test machine and ensure it is the default.
(success)
-Stop and restart the ABC on COM+ (success)
-Start Axapta using the default icon to ensure the configuration allows the
machine to run Axapta. (success)
-Start the AxaptaCommsTest application and attempt to connect (fails)
Do you have any other suggestions?
//CSHARP CODE
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Microsoft.Win32;
using AxaptaCOMConnector;
namespace AxaptaCommsTest
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private const string AXAPTA_30_REGKEY = "Software\\Navision\\Axapta\\3.0";
private string config = "";
private IAxapta2 axapta;
private ArrayList lines;
private AxaptaParameterListClass axParamList;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox1;
private bool connected = false;
private System.Windows.Forms.TextBox txtResult;
private System.Windows.Forms.ComboBox lstConfig;
private System.Windows.Forms.Timer tmrCallMethod;
private System.Windows.Forms.Button btnConnect;
private System.ComponentModel.IContainer components;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//Private init
axapta = new Axapta2();
axParamList = new AxaptaParameterListClass();
lines = new ArrayList();
selectConfig();
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
if(connected)
{
axapta.Logoff();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.btnConnect = new System.Windows.Forms.Button();
this.txtResult = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lstConfig = new System.Windows.Forms.ComboBox();
this.tmrCallMethod = new System.Windows.Forms.Timer(this.components);
this.panel1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// btnConnect
//
this.btnConnect.Location = new System.Drawing.Point(211, 32);
this.btnConnect.Name = "btnConnect";
this.btnConnect.TabIndex = 0;
this.btnConnect.Text = "Connect";
this.btnConnect.Click += new System.EventHandler(this.button1_Click);
//
// txtResult
//
this.txtResult.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtResult.Location = new System.Drawing.Point(3, 16);
this.txtResult.Multiline = true;
this.txtResult.Name = "txtResult";
this.txtResult.Size = new System.Drawing.Size(286, 183);
this.txtResult.TabIndex = 3;
this.txtResult.Text = "";
//
// panel1
//
this.panel1.Controls.Add(this.lstConfig);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.btnConnect);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(292, 64);
this.panel1.TabIndex = 4;
//
// label1
//
this.label1.Location = new System.Drawing.Point(6, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(78, 23);
this.label1.TabIndex = 3;
this.label1.Text = "Configuration";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.txtResult);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(0, 64);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(292, 202);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Result";
//
// lstConfig
//
this.lstConfig.Location = new System.Drawing.Point(78, 8);
this.lstConfig.Name = "lstConfig";
this.lstConfig.Size = new System.Drawing.Size(208, 21);
this.lstConfig.TabIndex = 4;
this.lstConfig.Text = "comboBox1";
//
// tmrCallMethod
//
this.tmrCallMethod.Interval = 1000;
this.tmrCallMethod.Tick += new
System.EventHandler(this.tmrCallMethod_Tick);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.panel1);
this.Name = "Form1";
this.Text = "Axapta connection test";
this.panel1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
if(!connected)
{
connect();
}
else
{
disconnect();
}
}
private void connect()
{
try
{
lines.Insert(0, "*****CONNECTING*****");
selectConfig();
axapta.Logon2("", "", "", "", "", "",
config, false, "", "");
connected = true;
lines.Insert(0, "*****CONNECTED*****");
tmrCallMethod.Enabled = true;
}
catch(Exception ex)
{
lines.Insert(0, "*****FAILED:*****");
lines.Insert(0, ex.Message);
lines.Insert(0, ex.StackTrace);
}
btnConnect.Text = (connected)?"Disconnect":"Connect";
txtResult.Lines = (string []) lines.ToArray(typeof(string));
}
private void disconnect()
{
try
{
lines.Insert(0, "*****DISCONNECTING*****");
connected = false;
tmrCallMethod.Enabled = false;
axapta.Logoff();
lines.Insert(0, "*****DISCONNECTED*****");
}
catch(Exception ex)
{
lines.Insert(0, "*****FAILED:*****");
lines.Insert(0, ex.Message);
lines.Insert(0, ex.StackTrace);
}
btnConnect.Text = (connected)?"Disconnect":"Connect";
txtResult.Lines = (string []) lines.ToArray(typeof(string));
}
private void selectConfig()
{
string [] configurationNames;
int selectedIndex = -1;
int currentIndex = 0;
RegistryKey key;
//Populate the configuration list from the registry
key = Registry.CurrentUser.OpenSubKey(AXAPTA_30_REGKEY);
if(null == key)
{
key = Registry.LocalMachine.OpenSubKey(AXAPTA_30_REGKEY);
}
if(null != key)
{
lstConfig.Items.Clear();
configurationNames = key.GetSubKeyNames();
foreach(string configurationName in configurationNames)
{
if(configurationName.Equals(config))
{
selectedIndex = currentIndex;
}
lstConfig.Items.Add(configurationName);
currentIndex++;
}
//Check for a non matching config, and set the selection
if(-1 == selectedIndex)
{
selectedIndex = 0;
config = configurationNames[selectedIndex];
}
lstConfig.SelectedIndex = selectedIndex;
}
else
{
lines.Insert(0, "Registry key "+AXAPTA_30_REGKEY+" not found.");
}
txtResult.Lines = (string []) lines.ToArray(typeof(string));
}
private void tmrCallMethod_Tick(object sender, System.EventArgs e)
{
int outTickCount;
int retTickCount;
int inTickCount;
try
{
outTickCount = Environment.TickCount;
axParamList.Size = 0;
retTickCount = (int) axapta.CallStaticClassMethodEx("WinAPI",
"getTickCount", axParamList);
inTickCount = Environment.TickCount;
lines.Insert(0, "round trip: "+(inTickCount-outTickCount)+"ms");
}
catch (Exception ex)
{
lines.Insert(0, ex.Message);
lines.Insert(0, ex.StackTrace);
disconnect();
}
txtResult.Lines = (string []) lines.ToArray(typeof(string));
}
}
}
//CSHARP CODE
Regards,
Matt Benic
.Net/Axapta Analyst Developer
UTi Sun Couriers Division
Support the Xbox 360 in SA campaign
<http://forums.xbox.com/ShowPost.aspx?PostID=12592431>
-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] Behalf Of Matt Benic
Sent: 03 June 2005 08:37 AM
To: [email protected]
Subject: RE: [development-axapta] COM file access error
Hi Lars,
No outside access will happen via this component, it is simply an automated
process to call exposed methods to import sales orders realtime to replace
our batched file based solution, so security is not a big issue (though
obviously a fair amount of password control and such has been built in.
I did ask my tester to copy over the Navision registry settings and that did
not help- but I don't think they deleted the exisiting user specific
version. I will try that, thanks.
Regards,
Matt Benic
.Net/Axapta Analyst Developer
UTi Sun Couriers Division
Support the Xbox 360 in SA campaign
<http://forums.xbox.com/ShowPost.aspx?PostID=12592431>
-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] Behalf Of
[EMAIL PROTECTED]
Sent: 02 June 2005 04:23 PM
To: [email protected]
Subject: RE: [development-axapta] COM file access error
When Axapta is running from a service or web app there isnt nessesary any
current user and in that case Axapta cannot find the configuration
information from HKEY_CURRENT_USER
If you copy the registry settings from HKEY_CURRENT_USER to
HKEY_LOCAL_MACHINE and remove the settings from HKEY_CURRENT_USER you can be
sure that Axapta picks up the right configuration.
I can see that you already have registret the COM+ application under a
specific user and that should take care of it, but just to make sure you
should try it out.
If this doesnt help, you should try running the service under the same user
account you are using for the COM+ application. Maybe it has something do
with rights.
If your service act as a server as well and accept connections from the
outside, you should be a little carefull by doing this from a security
perspective.
-------------- Original message --------------
I know it can work, since as I said it works in my dev environment, but it
seems to be related to this machine. Could it have something to do with the
fact that the test machine first had axapta installed using web deployment,
then uninstalled then reinstalled locally?
I will try the registry edit. Could you tell me why this might have an
effect?
Regards,
Matt Benic
.Net/Axapta Analyst Developer
UTi Sun Couriers Division
Support the Xbox 360 in SA campaign
<http://forums.xbox.com/ShowPost.aspx?PostID=12592431>
-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] Behalf Of
[EMAIL PROTECTED]
Sent: 02 June 2005 04:53 AM
To: [email protected]
Subject: Re: [development-axapta] COM file access error
I have done this as well and it worked, so it is possible to call the
business connector from a service.
Which user does your service run on?
You could try this. Copy the Navision registry key from HKEY_CURRENT_USER to
HKEY_LOCAL_MACHINE
-------------- Original message --------------
Hi all,
I have developed a windows service in C# that makes use of the ABC. It works
on my development environment, but on my test system, an exception is
generated by a call to IAxapta2.Logon2 with the following message:
{"File Error : The application files are not accessible. This can be caused
by another Navision Axapta instance using the application files in exclusive
mode.\n\nNavision Axapta cannot be executed. Please restart the Navision
Axapta Business Connector before logging on." }
A client on the test machine using the same configuration as the ABC starts
up successfully, so the current user definitely has access to the app and
bin files. The configuration is for a two-tier connection, and the ABC
component (registered on COM+) is definitely running under the local user
account (ie the same account that the client would use to access the files).
Does anyone have any suggestions?
Regards,
Matt Benic
.Net/Axapta Analyst Developer
UTi Sun Couriers Division
Support the Xbox 360 in SA campaign
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
Yahoo! Groups Links
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
Yahoo! Groups Links
Yahoo! Groups Links
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

