I'm getting the following error when I print from my web application using .NET SDK (c#) on IIS 6 on a Windows 2003 R2 server:
The BarTender engine could not be started. Possible reasons are:
1) BarTender is not properly installed.
2) BarTender is not properly registered on the computer (e.g bartend.exe /register).
3) There are too many process instances of BarTender running. Stop a few bartend.exe instances and try again. Also see SDK Engine.Start method documentation for information about how to allow more BarTender processes to run on your computer by increasing your "non-interactive" shared desktop heap.
4) The user account does not have permission to run BarTender.
My web app is a simple one that passes a SQL query to a BarTender label and then prints it. It runs fine on my development PC (Windows 7 Professional)
Code for the BarTender Print function:
Engine btEngine = new Engine();
// Start BarTender Engine
// Retrieve the preferred license connection.
LicenseConnection connection = btEngine.LicenseServer.PreferredConnection;
// Check if the engine is connected to license server.
if (btEngine.LicenseServer.Connect()) eMsg = "Connected BarTender engine to a License Server";
else eMsg = "Failed to connect BarTender engine to a License Server";
// Open the Label
LabelFormatDocument btFormat = btEngine.Documents.Open(BTlabelStr, BTprinter);
// Set the variable Named Substrings
btFormat.SubStrings["Ref1"].Value = Ref1TextBox.Text;
btFormat.SubStrings["Ref2"].Value = Ref2TextBox.Text;
// Open Database connection for label
((OLEDB)btFormat.DatabaseConnections).SQLStatement = VarQueryStr;
// Select the options for printing
if (labelcountTextBox.Text == "") labelcountTextBox.Text = "1";
btFormat.PrintSetup.IdenticalCopiesOfLabel = Int32.Parse(labelcountTextBox.Text.ToString().Trim());
// Print the label format document
Messages btMessages = null;
Result result = btFormat.Print(BTlabelStr, out btMessages);
// Stop the engine
// clean up the resources
catch (Exception ex)
eMsg = ex.Message;
Also, the following message appears in the Event Log (under Application):
Faulting application bartend.exe, version 10.1.0.2926, faulting module unknown, version 0.0.0.0, fault address 0x00000000.
I'm running 2.x version of .NET because, I couldn't get the web app to run on 3.5 on a Windows 2008 R2 x64 IIS server.
Does anybody have an information on the optimal environment for using this SDK?