Windows Service to copy files to a Mapped Drive

  • Thread starter Thread starter sajid_yusuf
  • Start date Start date
S

sajid_yusuf

Hi

I am trying to develop a Windows service in VB.NET which has timer
enabled and keeps checking a folder (or group of folders) for any new
file or changed files. As soon as it detects any new file or changes
(to files or folders) then it copies the files (and any new folders) to
a folder in the mapped network drive.

So far I have been successful in developing and deploying the service
which works on my local machine with two drives (C and D) and the
windows service can copy files from the source folder in C drive to D
drive successfully but when I change the destination folder to a mapped
drive on the network then it doesn't work at all. I have two computers
on the LAN in WORKGROUP mode and I have checked the permissions on the
destination folder and all look pretty fine (no firewall or anything).
I can copy the files manually to the destination folder without any
problem so why can't the windows service do.

I am really wondering what is the problem.

Please help me with this problem.

Thank you,

SY
 
I am trying to develop a Windows service in VB.NET which has timer
enabled and keeps checking a folder (or group of folders) for any new
file or changed files. As soon as it detects any new file or changes
(to files or folders) then it copies the files (and any new folders) to
a folder in the mapped network drive.

Why use a Timer? I'd use a [System.IO.]FileSystemWatcher that fires
events at your Service every time a file is updated/added/removed?
I can copy the files manually to the destination folder without any
problem so why can't the windows service do.

Services generally run under the Local System account, which can do lots
(and lots) of things on that, one machine, but knows absolutely nothing
about the network.
If you're on Windows Server 2003, use the Network Service(?) account or,
failing that, nominate a domain account and run the service under that.

HTH,
Phill W.
 
Aside, from what Phil W. says, I'd also say to NOT use a mapped drive in a
service context. Always use a UNC for the destination.
 
Hi

I really appreciate all of you who responded to my question. I would be
obliged if someone can share code with me to simply watch a folder (on
a local machine running the service) for any changes and fire event to
copy/update a folder on the network drive.

That would be a great help.
 
Hi

I really appreciate all of you who responded to my question. I would be
obliged if someone can share code with me to simply watch a folder (on
a local machine running the service) for any changes and fire event to
copy/update a folder on the UNC path (somewhere on the network).

That would be a great help.
 
Back
Top