I've written a Windows Service. It uses Process.Start() to launch a Console Application. The console application performs a File.Copy(), to copy a file from the local file system to a network share.
Problem: The file copy fails. I get an exception that tells me "part of the path could not be found".
When I run the Console Application directly, I don't get the error.
My Guess: I'm guessing that services, and processes spawned by services, do not have permissions to access non-local resources, including network shares.
My Attempted Fix: Run the service under a different user account. It didn't work.
This is for a large transactional processing job. There is a dedicated server that periodically receives (through web services) thousands upon thousands of "transactions". These take the form of individual files, organized into a 5-level hierarchy. Each level has a folder, so the folder structure might be:
The "files" represent the individual transations. When a particular "LEVEL_D" is complete, a log file is created.
It can take DAYS to generate all the files. Currently, when the process is complete, someone manually organizes and processes the transations. Yuck.
My Windows Service implements a FileWatcher to look for the creation of the "log" files. When a log file is created, that means there is a "batch" of transactions that can be processed. When a log file is completed, I use System.Diagnostics.Process.Start() to launch a Console Application.
The Console Application contains no User Interface. All it does, really, is file i/o. One of the final steps is to take a newly created file (a pre-processed, concatenation of a transaction "batch") and copy it to another server for final production. It's this step that fails.