CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2009
    Posts
    2

    Question regarding windows services and the Process class

    Hello everybody,
    I have a problem to which I haven't been able to find an answer through Google. I am making a windows service that reads image files in an input folder and then profiles the document in a document management system. The program can't manipulate images itself so it's OCR and Barcode reading, and image splitting, converting and combining functions are performed in separate applications using the System.Diagnostics.Process class.

    The problem I am running into is that when I call my TiffSplitter app I get a System.OutOfMemoryException when I the image is first loaded into the program. In initial testing I found that I could set the "Allow service to interact with desktop" property of the service and it would run on my development PC but this quick fix didn't solve the problem on a client site.

    I know that setting that property isn't a proper solution either so I'm open to ideas as to how to properly fix this. The reason this program is a service is so that it will auto start on system startup and doesn't require a windows user to log on to windows to start working. Is there any way of increasing the amount of memory that a process can use? Or is there some other solution that I'm missing?

    Here some info about The PC's and the Program:
    Development PC-
    OS: WIN XP with SP2
    Pentium 4 2.80GHz
    2GB Ram

    Client Server-
    OS: WIN Server 2003
    Runs on a virtual machine

    TiffSplitter app-
    vb6 app
    Uses Imaging Pro to split and OCR Tiffs
    Program loads fine but errors out on the image loading functions

    Service app-
    C# 2.0 app
    Uses following code [Paraphrased] to open TiffSpliter:

    using (Process p = new Process())
    {
    p.StartInfo.CreateNoWindow = true;
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.Arguments = [args];
    p.StartInfo.FileName = [exe];
    p.Start();
    p.WaitForExit();
    p.Close();
    }


    Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Question regarding windows services and the Process class

    I doubt your service has permissions. You might want to impersonate the administrator
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Oct 2009
    Posts
    2

    Re: Question regarding windows services and the Process class

    Thanks for your reply. I retried that on the client machine but to no avail. The service was set to run as administrator on my development PC when the issue first arose, which led me to setting the services logon to the local system account with access to the desktop. Is there a way you can access the desktop while not using the local system account? Also if there is a non-permissions way of fixing this that would be great too.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured