I have a simple service that reads directory values from the registry, then locates the file they point to and copies it to the local machine. The service properly installs and runs on all of the machines that are a part of my office domain.
I am currently trying to get it to work on a computer that is part of the office network, but not joined to the domain. I can successfully UNC to the directory I want (\\myServer\install$\batch
file.bat is what I'm trying to reach). I wrote a few lines of code in C# and compiled them; I pulled the registry values to form the path as usual, then used System.IO.File.Exists to check that file - and it can be seen fine! I used the directory object to check multiple directories and list the files therein - and THAT works fine too. Its only when I'm attempting to use my service that it checks the exact same file path and says file not found. It makes no sense.
Furthermore, I tried checking ANY machine that is on the local network. As long as my service is not trying to do the check, I can UNC to the computers, and I can programmatically check for files or directories... its only when the service is trying to do it that it doesnt work.
In the code section below I listed part of the installation I use. I've tried using ServiceAccount.NetworkServ
ice (shown here) and ServiceAccount.LocalSystem
(this is how I installed it on the domain machines, all of which are working properly) and neither one helps. I would really, really like to avoid having to add all of these machines to the domain. There is no reason for them to be added, as it would drive our costs way up, but I need this program to work, and work now. My deadline is almost up and I cannot figure out what is wrong.
ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();
ServiceInstaller serviceInstaller = new ServiceInstaller();
// Service Account Information
serviceProcessInstaller.Account = ServiceAccount.NetworkService;
serviceProcessInstaller.Username = null;
serviceProcessInstaller.Password = null;