4
Note: I've been able to duplicate my problem by using another WinXp computers instead of a USB drive plugged into my router. Same exact problem. So, the bottom line is that I can access (and modify) the files across the network if I'm doing so manually, but my Windows service fails when trying to do the same thing. If I run the program through Visual Studio, it works. If I run that same exact code as a Windows service, it fails.
I've created a Windows service that needs to access a common network location. To test it at home, I plugged a USB drive into my Netgear N600 WNDR3400 router. The USB storage settings show the workgroup name as Workgroup, and the file path is:
\\readyshare\USB_Storage
The service can't access the files within that network folder. I get an error that the file can't be found, or that permission was denied, depending on what I try. (The file does indeed exist.) However, I can access/modify those files directly from my laptop (Win8), and I can do the same thing on my wife's laptop (WinXP). The service is running as the Local System
user.
I've tried running as Network Service
, as .\administrator
, and as .\JaneDoe
. No luck.
I also tried changing the permissions on the newtwork folders, but it doesn't stick. For example, if I try to give Everyone
full control:
It just reverts to the previous state after I hit apply:
I've also tried adding a new user (see Add button above), but then I get this error:
Any ideas how I can make this work? I simply want my service to have read/write (even full, I don't care) access to the folders on this network.
Edit - I used Process Monitor, and, as expected, this is the error:
More Failed Attempts
- Use different USB drive
- Disable Windows firewall on the XP box
- Instead of using the UNC path, use a mapped drive
EDIT - Code to Access the Network Files Note: The file is not found (even though it exists).
private UpdaterManifest GetUpdaterManifest()
{
string filePathAndName = Path.Combine(this._sourceBinaryPath, this._appName + ".UpdaterManifest");
if (!File.Exists(filePathAndName))
{
// Always hit here
}
}
Can you post the code that's used to access the file? – Supun – 2013-02-18T19:55:53.483
Also try the following links : link or link
– Supun – 2013-02-18T20:05:37.650@Supun I've tried many things, including items in the links you provided. Nothing has worked so far. I also posted my code at the end of my question. – Bob Horn – 2013-02-20T02:29:04.110
Home. It's in the new title. :) – Bob Horn – 2013-02-20T02:48:04.133
Pretty ambiguous. It could be a "Windows XP" ... wait for it ... "Home Network" or "Windows XP Home" "Network" ... you see? Also this means I don't know the answer (or am unsure at least). I would have known it for Pro. – 0xC0000022L – 2013-02-20T02:50:09.357
@0xC0000022L Good point. I just changed the title. Does that make it clear? – Bob Horn – 2013-02-20T02:53:18.623