Error After Website Runs For ~ 1 Day Follow

0
Avatar
Legacy Poster

I ported the code from the .NET SDK into our website project (not web application).  We compiled the site and put it onto one of our test servers.  After about a day, the server started returning an error on the login page.  I stopped then started the website's application pool and the error went away.  A day later and it is now back.  Here is the screen output:
 
Server Error in '/' Application.
 
This operation cannot be performed unless the Engine is running. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
 
 Exception Details: Seagull.BarTender.Print.PrintEngineException: This operation cannot be performed unless the Engine is running.
 
Source Error: 
 
 An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
 
Stack Trace: 
 
[PrintEngineException: This operation cannot be performed unless the Engine is running.]
   Seagull.BarTender.Print.Engine.CheckIsAlive() +71
   vertere.Login.Page_Load(Object sender, EventArgs e) +237
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
 
  
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34280 

 
The only code regarding bartender in the login page is in the Page_Load:
 

    TaskManager taskManager = (TaskManager)Application["TaskManager"];
    string BTversion = "Bartender not installed.";
    if ((taskManager != null) && (taskManager.TaskEngines.Count > 0))
    {
        BTversion = "Using Bartender version: " + taskManager.TaskEngines[0].FullVersion;
    }
    lblBTversion.Text = BTversion;

 
To further complicate things, when I run in debug, the Application["TaskManager"] is null because the code in global.asax Application_Start(), pulled from the SDK:
 

        TaskManager taskManager = null;
        try
        {
            taskManager = new TaskManager();
            taskManager.Start(1);
            Application["TaskManager"] = taskManager;

            // Get the temporary folder where all print previews are stored and 
            // store it into an application variable for later use in Session_End.
            string tempFolder = "~/UserData/BarcodeFiles/Temp";
            if (string.IsNullOrEmpty(tempFolder))
                tempFolder = "Temp";

            string tempFolderFullPath = Server.MapPath(tempFolder);

            if (!System.IO.Directory.Exists(tempFolderFullPath))
            {
                System.IO.Directory.CreateDirectory(tempFolderFullPath);
            }

            Application["TempFolderFullPath"] = tempFolderFullPath;
        }
        catch (Exception ex)
        {
            // Something went wrong. Let other modules handle the error appropriately.
            Application["TaskManager"] = null;
            Application["TempFolderFullPath"] = "";
            if (taskManager != null)
            {
                taskManager.Dispose();
            }
        }

 
throws an exception saying that the requested number of engines can't be started, with an inner exception of access denied.  So thus far I've been unable to reproduce the error that's happening on the test server.  
 
I've seen at least one post regarding possible memory leaks, but there were no bartender.exe processes running that I found.  I'll check again when the error happens on the test server tomorrow.
 
Any ideas as to what could be causing the error I'm seeing on the test server (the error in red, above)?

Please sign in to leave a comment.