Click to See Complete Forum and Search --> : Question regarding windows services and the Process class


Fallout_Monkey
October 13th, 2009, 03:53 PM
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.

dglienna
October 13th, 2009, 05:49 PM
I doubt your service has permissions. You might want to impersonate the administrator

Fallout_Monkey
October 13th, 2009, 06:09 PM
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.