Home All Groups Group Topic Archive Search About

Windows Service to copy files to a Mapped Drive

Author
22 Dec 2006 6:02 AM
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

Author
22 Dec 2006 12:05 PM
Phill W.
sajid_yu***@yahoo.com wrote:

> 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.
Author
22 Dec 2006 7:45 PM
Jeff Jarrell
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.

<sajid_yu***@yahoo.com> wrote in message
Show quoteHide quote
news:1166767372.955240.193620@f1g2000cwa.googlegroups.com...
> 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
>
Author
26 Dec 2006 8:06 AM
sajid_yusuf
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.



Jeff Jarrell wrote:
Show quoteHide quote
> 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.
>
> <sajid_yu***@yahoo.com> wrote in message
> news:1166767372.955240.193620@f1g2000cwa.googlegroups.com...
> > 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
> >
Author
26 Dec 2006 8:07 AM
sajid_yusuf
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.



Jeff Jarrell wrote:
Show quoteHide quote
> 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.
>
> <sajid_yu***@yahoo.com> wrote in message
> news:1166767372.955240.193620@f1g2000cwa.googlegroups.com...
> > 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
> >