|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Windows Service Cannot Move FilesI have wrriten a small windows service application in visual studio
..net 2003 which listens for incoming FTP files. These files would overwrite over time due to duplicate file names. However any time the windows service tries to rename the file (using flFile.move(source,destination)) it gets an error saying access is denied. The files are on the network, so we though the local system account may not have access We tried changing the account the service uses to a domain admin, but still got the same error. The application runs fine as VB windows form Any ideas, why windows service cannot do the same. Many Thanks Dermot French Windows services, by default, don't have access to the network. In w2k and
XP there is a network version of the system account you can use. Mike Ober. Show quoteHide quote "dermot" <dfre***@tommyfrench.co.uk> wrote in message news:1153778884.852703.162660@s13g2000cwa.googlegroups.com... > I have wrriten a small windows service application in visual studio > .net 2003 which listens for incoming FTP files. > These files would overwrite over time due to duplicate file names. > However any time the windows service tries to rename the file (using > flFile.move(source,destination)) it gets an error saying access is > denied. > > The files are on the network, so we though the local system account may > not have access > We tried changing the account the service uses to a domain admin, but > still got the same error. > > The application runs fine as VB windows form > > Any ideas, why windows service cannot do the same. > > Many Thanks > Dermot French > Mike,
I actually changed the account that starts it to a domain admin account. It can see the files (which the local system could not) - however it cannot move the files (gets the access denied message)? The services is running on a win 2003 server machine. Any ideas Regards, Dermot Michael D. Ober wrote: Show quoteHide quote > Windows services, by default, don't have access to the network. In w2k and > XP there is a network version of the system account you can use. > > Mike Ober. > > "dermot" <dfre***@tommyfrench.co.uk> wrote in message > news:1153778884.852703.162660@s13g2000cwa.googlegroups.com... > > I have wrriten a small windows service application in visual studio > > .net 2003 which listens for incoming FTP files. > > These files would overwrite over time due to duplicate file names. > > However any time the windows service tries to rename the file (using > > flFile.move(source,destination)) it gets an error saying access is > > denied. > > > > The files are on the network, so we though the local system account may > > not have access > > We tried changing the account the service uses to a domain admin, but > > still got the same error. > > > > The application runs fine as VB windows form > > > > Any ideas, why windows service cannot do the same. > > > > Many Thanks > > Dermot French > > hi dermot
I think you are trying to get the files while they are still used by the tcp. You should allow some delay. When a file arrives do not assault it ! Place a timer and make an attempt every half second. You will see some attempt will eventually succeed. Can place a limit to the number of attempts and log the possible unsuccesses.... let me know -tom dermot ha scritto: Show quoteHide quote > Mike, > I actually changed the account that starts it to a domain admin > account. It can see the files (which the local system could not) - > however it cannot move the files (gets the access denied message)? > > The services is running on a win 2003 server machine. > Any ideas > > Regards, > Dermot > > > Michael D. Ober wrote: > > Windows services, by default, don't have access to the network. In w2k and > > XP there is a network version of the system account you can use. > > > > Mike Ober. > > > > "dermot" <dfre***@tommyfrench.co.uk> wrote in message > > news:1153778884.852703.162660@s13g2000cwa.googlegroups.com... > > > I have wrriten a small windows service application in visual studio > > > .net 2003 which listens for incoming FTP files. > > > These files would overwrite over time due to duplicate file names. > > > However any time the windows service tries to rename the file (using > > > flFile.move(source,destination)) it gets an error saying access is > > > denied. > > > > > > The files are on the network, so we though the local system account may > > > not have access > > > We tried changing the account the service uses to a domain admin, but > > > still got the same error. > > > > > > The application runs fine as VB windows form > > > > > > Any ideas, why windows service cannot do the same. > > > > > > Many Thanks > > > Dermot French > > > That isn't the problem
It uses a notify filter, for last write and then delays This works fine using exact same code from a Windows form application (just doesn't work when I change it to Windows Services Application). Regards, Dermot tommaso.gasta***@uniroma1.it wrote: Show quoteHide quote > hi dermot > > I think you are trying to get the files while they are still used by > the tcp. > > You should allow some delay. When a file arrives do not assault it ! > > Place a timer and make an attempt every half second. You will see > some attempt will eventually succeed. Can place a limit to the number > of > attempts and log the possible unsuccesses.... let me know > > -tom > > dermot ha scritto: > > > Mike, > > I actually changed the account that starts it to a domain admin > > account. It can see the files (which the local system could not) - > > however it cannot move the files (gets the access denied message)? > > > > The services is running on a win 2003 server machine. > > Any ideas > > > > Regards, > > Dermot > > > > > > Michael D. Ober wrote: > > > Windows services, by default, don't have access to the network. In w2k and > > > XP there is a network version of the system account you can use. > > > > > > Mike Ober. > > > > > > "dermot" <dfre***@tommyfrench.co.uk> wrote in message > > > news:1153778884.852703.162660@s13g2000cwa.googlegroups.com... > > > > I have wrriten a small windows service application in visual studio > > > > .net 2003 which listens for incoming FTP files. > > > > These files would overwrite over time due to duplicate file names. > > > > However any time the windows service tries to rename the file (using > > > > flFile.move(source,destination)) it gets an error saying access is > > > > denied. > > > > > > > > The files are on the network, so we though the local system account may > > > > not have access > > > > We tried changing the account the service uses to a domain admin, but > > > > still got the same error. > > > > > > > > The application runs fine as VB windows form > > > > > > > > Any ideas, why windows service cannot do the same. > > > > > > > > Many Thanks > > > > Dermot French > > > > Watch out for using mapped drive letters. These are done on a
user-by-user basis when they log in. Try using the full network path (like //corp_server/datadir/targetfile.txt) and see if that helps. Tom dermot wrote: Show quoteHide quote > That isn't the problem > It uses a notify filter, for last write and then delays > > This works fine using exact same code from a Windows form application > (just doesn't work when I change it to Windows Services Application). > > Regards, > Dermot > > tommaso.gasta***@uniroma1.it wrote: > > hi dermot > > > > I think you are trying to get the files while they are still used by > > the tcp. > > > > You should allow some delay. When a file arrives do not assault it ! > > > > Place a timer and make an attempt every half second. You will see > > some attempt will eventually succeed. Can place a limit to the number > > of > > attempts and log the possible unsuccesses.... let me know > > > > -tom > > > > dermot ha scritto: > > > > > Mike, > > > I actually changed the account that starts it to a domain admin > > > account. It can see the files (which the local system could not) - > > > however it cannot move the files (gets the access denied message)? > > > > > > The services is running on a win 2003 server machine. > > > Any ideas > > > > > > Regards, > > > Dermot > > > > > > > > > Michael D. Ober wrote: > > > > Windows services, by default, don't have access to the network. In w2k and > > > > XP there is a network version of the system account you can use. > > > > > > > > Mike Ober. > > > > > > > > "dermot" <dfre***@tommyfrench.co.uk> wrote in message > > > > news:1153778884.852703.162660@s13g2000cwa.googlegroups.com... > > > > > I have wrriten a small windows service application in visual studio > > > > > .net 2003 which listens for incoming FTP files. > > > > > These files would overwrite over time due to duplicate file names. > > > > > However any time the windows service tries to rename the file (using > > > > > flFile.move(source,destination)) it gets an error saying access is > > > > > denied. > > > > > > > > > > The files are on the network, so we though the local system account may > > > > > not have access > > > > > We tried changing the account the service uses to a domain admin, but > > > > > still got the same error. > > > > > > > > > > The application runs fine as VB windows form > > > > > > > > > > Any ideas, why windows service cannot do the same. > > > > > > > > > > Many Thanks > > > > > Dermot French > > > > > I am using the full network path
The windows service can see the original files, it just cannot rename them Any ideas? TDC wrote: Show quoteHide quote > Watch out for using mapped drive letters. These are done on a > user-by-user basis when they log in. Try using the full network path > (like //corp_server/datadir/targetfile.txt) and see if that helps. > > Tom > > > dermot wrote: > > That isn't the problem > > It uses a notify filter, for last write and then delays > > > > This works fine using exact same code from a Windows form application > > (just doesn't work when I change it to Windows Services Application). > > > > Regards, > > Dermot > > > > tommaso.gasta***@uniroma1.it wrote: > > > hi dermot > > > > > > I think you are trying to get the files while they are still used by > > > the tcp. > > > > > > You should allow some delay. When a file arrives do not assault it ! > > > > > > Place a timer and make an attempt every half second. You will see > > > some attempt will eventually succeed. Can place a limit to the number > > > of > > > attempts and log the possible unsuccesses.... let me know > > > > > > -tom > > > > > > dermot ha scritto: > > > > > > > Mike, > > > > I actually changed the account that starts it to a domain admin > > > > account. It can see the files (which the local system could not) - > > > > however it cannot move the files (gets the access denied message)? > > > > > > > > The services is running on a win 2003 server machine. > > > > Any ideas > > > > > > > > Regards, > > > > Dermot > > > > > > > > > > > > Michael D. Ober wrote: > > > > > Windows services, by default, don't have access to the network. In w2k and > > > > > XP there is a network version of the system account you can use. > > > > > > > > > > Mike Ober. > > > > > > > > > > "dermot" <dfre***@tommyfrench.co.uk> wrote in message > > > > > news:1153778884.852703.162660@s13g2000cwa.googlegroups.com... > > > > > > I have wrriten a small windows service application in visual studio > > > > > > .net 2003 which listens for incoming FTP files. > > > > > > These files would overwrite over time due to duplicate file names. > > > > > > However any time the windows service tries to rename the file (using > > > > > > flFile.move(source,destination)) it gets an error saying access is > > > > > > denied. > > > > > > > > > > > > The files are on the network, so we though the local system account may > > > > > > not have access > > > > > > We tried changing the account the service uses to a domain admin, but > > > > > > still got the same error. > > > > > > > > > > > > The application runs fine as VB windows form > > > > > > > > > > > > Any ideas, why windows service cannot do the same. > > > > > > > > > > > > Many Thanks > > > > > > Dermot French > > > > > > Are you sure that the account has write access to the directory and files?
Sounds like it only has read access. /claes Show quoteHide quote "dermot" <dfre***@tommyfrench.co.uk> wrote in message news:1153834300.863097.28130@h48g2000cwc.googlegroups.com... >I am using the full network path > The windows service can see the original files, it just cannot rename > them > > Any ideas? > > TDC wrote: >> Watch out for using mapped drive letters. These are done on a >> user-by-user basis when they log in. Try using the full network path >> (like //corp_server/datadir/targetfile.txt) and see if that helps. >> >> Tom >> >> >> dermot wrote: >> > That isn't the problem >> > It uses a notify filter, for last write and then delays >> > >> > This works fine using exact same code from a Windows form application >> > (just doesn't work when I change it to Windows Services Application). >> > >> > Regards, >> > Dermot >> > >> > tommaso.gasta***@uniroma1.it wrote: >> > > hi dermot >> > > >> > > I think you are trying to get the files while they are still used by >> > > the tcp. >> > > >> > > You should allow some delay. When a file arrives do not assault it ! >> > > >> > > Place a timer and make an attempt every half second. You will see >> > > some attempt will eventually succeed. Can place a limit to the number >> > > of >> > > attempts and log the possible unsuccesses.... let me know >> > > >> > > -tom >> > > >> > > dermot ha scritto: >> > > >> > > > Mike, >> > > > I actually changed the account that starts it to a domain admin >> > > > account. It can see the files (which the local system could not) - >> > > > however it cannot move the files (gets the access denied message)? >> > > > >> > > > The services is running on a win 2003 server machine. >> > > > Any ideas >> > > > >> > > > Regards, >> > > > Dermot >> > > > >> > > > >> > > > Michael D. Ober wrote: >> > > > > Windows services, by default, don't have access to the network. >> > > > > In w2k and >> > > > > XP there is a network version of the system account you can use. >> > > > > >> > > > > Mike Ober. >> > > > > >> > > > > "dermot" <dfre***@tommyfrench.co.uk> wrote in message >> > > > > news:1153778884.852703.162660@s13g2000cwa.googlegroups.com... >> > > > > > I have wrriten a small windows service application in visual >> > > > > > studio >> > > > > > .net 2003 which listens for incoming FTP files. >> > > > > > These files would overwrite over time due to duplicate file >> > > > > > names. >> > > > > > However any time the windows service tries to rename the file >> > > > > > (using >> > > > > > flFile.move(source,destination)) it gets an error saying access >> > > > > > is >> > > > > > denied. >> > > > > > >> > > > > > The files are on the network, so we though the local system >> > > > > > account may >> > > > > > not have access >> > > > > > We tried changing the account the service uses to a domain >> > > > > > admin, but >> > > > > > still got the same error. >> > > > > > >> > > > > > The application runs fine as VB windows form >> > > > > > >> > > > > > Any ideas, why windows service cannot do the same. >> > > > > > >> > > > > > Many Thanks >> > > > > > Dermot French >> > > > > > > It is a domain admin account, and has also been given all rights on the
folder in question. Claes Bergefall wrote: Show quoteHide quote > Are you sure that the account has write access to the directory and files? > Sounds like it only has read access. > > /claes > > > "dermot" <dfre***@tommyfrench.co.uk> wrote in message > news:1153834300.863097.28130@h48g2000cwc.googlegroups.com... > >I am using the full network path > > The windows service can see the original files, it just cannot rename > > them > > > > Any ideas? > > > > TDC wrote: > >> Watch out for using mapped drive letters. These are done on a > >> user-by-user basis when they log in. Try using the full network path > >> (like //corp_server/datadir/targetfile.txt) and see if that helps. > >> > >> Tom > >> > >> > >> dermot wrote: > >> > That isn't the problem > >> > It uses a notify filter, for last write and then delays > >> > > >> > This works fine using exact same code from a Windows form application > >> > (just doesn't work when I change it to Windows Services Application). > >> > > >> > Regards, > >> > Dermot > >> > > >> > tommaso.gasta***@uniroma1.it wrote: > >> > > hi dermot > >> > > > >> > > I think you are trying to get the files while they are still used by > >> > > the tcp. > >> > > > >> > > You should allow some delay. When a file arrives do not assault it ! > >> > > > >> > > Place a timer and make an attempt every half second. You will see > >> > > some attempt will eventually succeed. Can place a limit to the number > >> > > of > >> > > attempts and log the possible unsuccesses.... let me know > >> > > > >> > > -tom > >> > > > >> > > dermot ha scritto: > >> > > > >> > > > Mike, > >> > > > I actually changed the account that starts it to a domain admin > >> > > > account. It can see the files (which the local system could not) - > >> > > > however it cannot move the files (gets the access denied message)? > >> > > > > >> > > > The services is running on a win 2003 server machine. > >> > > > Any ideas > >> > > > > >> > > > Regards, > >> > > > Dermot > >> > > > > >> > > > > >> > > > Michael D. Ober wrote: > >> > > > > Windows services, by default, don't have access to the network. > >> > > > > In w2k and > >> > > > > XP there is a network version of the system account you can use. > >> > > > > > >> > > > > Mike Ober. > >> > > > > > >> > > > > "dermot" <dfre***@tommyfrench.co.uk> wrote in message > >> > > > > news:1153778884.852703.162660@s13g2000cwa.googlegroups.com... > >> > > > > > I have wrriten a small windows service application in visual > >> > > > > > studio > >> > > > > > .net 2003 which listens for incoming FTP files. > >> > > > > > These files would overwrite over time due to duplicate file > >> > > > > > names. > >> > > > > > However any time the windows service tries to rename the file > >> > > > > > (using > >> > > > > > flFile.move(source,destination)) it gets an error saying access > >> > > > > > is > >> > > > > > denied. > >> > > > > > > >> > > > > > The files are on the network, so we though the local system > >> > > > > > account may > >> > > > > > not have access > >> > > > > > We tried changing the account the service uses to a domain > >> > > > > > admin, but > >> > > > > > still got the same error. > >> > > > > > > >> > > > > > The application runs fine as VB windows form > >> > > > > > > >> > > > > > Any ideas, why windows service cannot do the same. > >> > > > > > > >> > > > > > Many Thanks > >> > > > > > Dermot French > >> > > > > > > > Please verify both the share permissions and the NTFS permissions. I had a
similar problem and my share permissions were wrong. Mike Ober. Show quoteHide quote "dermot" <dfre***@tommyfrench.co.uk> wrote in message news:1153865186.288388.28850@i3g2000cwc.googlegroups.com... > It is a domain admin account, and has also been given all rights on the > folder in question. > > > Claes Bergefall wrote: > > Are you sure that the account has write access to the directory and files? > > Sounds like it only has read access. > > > > /claes > > > > > > "dermot" <dfre***@tommyfrench.co.uk> wrote in message > > news:1153834300.863097.28130@h48g2000cwc.googlegroups.com... > > >I am using the full network path > > > The windows service can see the original files, it just cannot rename > > > them > > > > > > Any ideas? > > > > > > TDC wrote: > > >> Watch out for using mapped drive letters. These are done on a > > >> user-by-user basis when they log in. Try using the full network path > > >> (like //corp_server/datadir/targetfile.txt) and see if that helps. > > >> > > >> Tom > > >> > > >> > > >> dermot wrote: > > >> > That isn't the problem > > >> > It uses a notify filter, for last write and then delays > > >> > > > >> > This works fine using exact same code from a Windows form application > > >> > (just doesn't work when I change it to Windows Services Application). > > >> > > > >> > Regards, > > >> > Dermot > > >> > > > >> > tommaso.gasta***@uniroma1.it wrote: > > >> > > hi dermot > > >> > > > > >> > > I think you are trying to get the files while they are still used by > > >> > > the tcp. > > >> > > > > >> > > You should allow some delay. When a file arrives do not assault it ! > > >> > > > > >> > > Place a timer and make an attempt every half second. You will see > > >> > > some attempt will eventually succeed. Can place a limit to the number > > >> > > of > > >> > > attempts and log the possible unsuccesses.... let me know > > >> > > > > >> > > -tom > > >> > > > > >> > > dermot ha scritto: > > >> > > > > >> > > > Mike, > > >> > > > I actually changed the account that starts it to a domain admin > > >> > > > account. It can see the files (which the local system could not) - > > >> > > > however it cannot move the files (gets the access denied message)? > > >> > > > > > >> > > > The services is running on a win 2003 server machine. > > >> > > > Any ideas > > >> > > > > > >> > > > Regards, > > >> > > > Dermot > > >> > > > > > >> > > > > > >> > > > Michael D. Ober wrote: > > >> > > > > Windows services, by default, don't have access to the network. > > >> > > > > In w2k and > > >> > > > > XP there is a network version of the system account you can use. > > >> > > > > > > >> > > > > Mike Ober. > > >> > > > > > > >> > > > > "dermot" <dfre***@tommyfrench.co.uk> wrote in message > > >> > > > > news:1153778884.852703.162660@s13g2000cwa.googlegroups.com... > > >> > > > > > I have wrriten a small windows service application in visual > > >> > > > > > studio > > >> > > > > > .net 2003 which listens for incoming FTP files. > > >> > > > > > These files would overwrite over time due to duplicate file > > >> > > > > > names. > > >> > > > > > However any time the windows service tries to rename the file > > >> > > > > > (using > > >> > > > > > flFile.move(source,destination)) it gets an error saying access > > >> > > > > > is > > >> > > > > > denied. > > >> > > > > > > > >> > > > > > The files are on the network, so we though the local system > > >> > > > > > account may > > >> > > > > > not have access > > >> > > > > > We tried changing the account the service uses to a domain > > >> > > > > > admin, but > > >> > > > > > still got the same error. > > >> > > > > > > > >> > > > > > The application runs fine as VB windows form > > >> > > > > > > > >> > > > > > Any ideas, why windows service cannot do the same. > > >> > > > > > > > >> > > > > > Many Thanks > > >> > > > > > Dermot French > > >> > > > > > > > > > > It was permissions, the person who installed it had no put it under the
correct account. Thanks for the help - it is now working Michael D. Ober wrote: Show quoteHide quote > Please verify both the share permissions and the NTFS permissions. I had a > similar problem and my share permissions were wrong. > > Mike Ober. > > "dermot" <dfre***@tommyfrench.co.uk> wrote in message > news:1153865186.288388.28850@i3g2000cwc.googlegroups.com... > > It is a domain admin account, and has also been given all rights on the > > folder in question. > > > > > > Claes Bergefall wrote: > > > Are you sure that the account has write access to the directory and > files? > > > Sounds like it only has read access. > > > > > > /claes > > > > > > > > > "dermot" <dfre***@tommyfrench.co.uk> wrote in message > > > news:1153834300.863097.28130@h48g2000cwc.googlegroups.com... > > > >I am using the full network path > > > > The windows service can see the original files, it just cannot rename > > > > them > > > > > > > > Any ideas? > > > > > > > > TDC wrote: > > > >> Watch out for using mapped drive letters. These are done on a > > > >> user-by-user basis when they log in. Try using the full network path > > > >> (like //corp_server/datadir/targetfile.txt) and see if that helps. > > > >> > > > >> Tom > > > >> > > > >> > > > >> dermot wrote: > > > >> > That isn't the problem > > > >> > It uses a notify filter, for last write and then delays > > > >> > > > > >> > This works fine using exact same code from a Windows form > application > > > >> > (just doesn't work when I change it to Windows Services > Application). > > > >> > > > > >> > Regards, > > > >> > Dermot > > > >> > > > > >> > tommaso.gasta***@uniroma1.it wrote: > > > >> > > hi dermot > > > >> > > > > > >> > > I think you are trying to get the files while they are still used > by > > > >> > > the tcp. > > > >> > > > > > >> > > You should allow some delay. When a file arrives do not assault > it ! > > > >> > > > > > >> > > Place a timer and make an attempt every half second. You will see > > > >> > > some attempt will eventually succeed. Can place a limit to the > number > > > >> > > of > > > >> > > attempts and log the possible unsuccesses.... let me know > > > >> > > > > > >> > > -tom > > > >> > > > > > >> > > dermot ha scritto: > > > >> > > > > > >> > > > Mike, > > > >> > > > I actually changed the account that starts it to a domain admin > > > >> > > > account. It can see the files (which the local system could > not) - > > > >> > > > however it cannot move the files (gets the access denied > message)? > > > >> > > > > > > >> > > > The services is running on a win 2003 server machine. > > > >> > > > Any ideas > > > >> > > > > > > >> > > > Regards, > > > >> > > > Dermot > > > >> > > > > > > >> > > > > > > >> > > > Michael D. Ober wrote: > > > >> > > > > Windows services, by default, don't have access to the > network. > > > >> > > > > In w2k and > > > >> > > > > XP there is a network version of the system account you can > use. > > > >> > > > > > > > >> > > > > Mike Ober. > > > >> > > > > > > > >> > > > > "dermot" <dfre***@tommyfrench.co.uk> wrote in message > > > >> > > > > news:1153778884.852703.162660@s13g2000cwa.googlegroups.com... > > > >> > > > > > I have wrriten a small windows service application in > visual > > > >> > > > > > studio > > > >> > > > > > .net 2003 which listens for incoming FTP files. > > > >> > > > > > These files would overwrite over time due to duplicate file > > > >> > > > > > names. > > > >> > > > > > However any time the windows service tries to rename the > file > > > >> > > > > > (using > > > >> > > > > > flFile.move(source,destination)) it gets an error saying > access > > > >> > > > > > is > > > >> > > > > > denied. > > > >> > > > > > > > > >> > > > > > The files are on the network, so we though the local system > > > >> > > > > > account may > > > >> > > > > > not have access > > > >> > > > > > We tried changing the account the service uses to a domain > > > >> > > > > > admin, but > > > >> > > > > > still got the same error. > > > >> > > > > > > > > >> > > > > > The application runs fine as VB windows form > > > >> > > > > > > > > >> > > > > > Any ideas, why windows service cannot do the same. > > > >> > > > > > > > > >> > > > > > Many Thanks > > > >> > > > > > Dermot French > > > >> > > > > > > > > > > > > >
Stopping Attributes.Add from converting my JavaScript event code to HTML
2 Gig Print Spooler process Fastest way to update a Picturebox's image Dispose of Notifier Icon Dynamic Properties hiding properties or methods in inherited class Sub Main Ends so does the application converting API call Editing XML Document VB Express |
|||||||||||||||||||||||