473,473 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Windows Service Cannot Move Files

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

Jul 24 '06 #1
10 4422
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" <df*****@tommyfrench.co.ukwrote in message
news:11**********************@s13g2000cwa.googlegr oups.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

Jul 24 '06 #2
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" <df*****@tommyfrench.co.ukwrote in message
news:11**********************@s13g2000cwa.googlegr oups.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
Jul 25 '06 #3
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" <df*****@tommyfrench.co.ukwrote in message
news:11**********************@s13g2000cwa.googlegr oups.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
>
Jul 25 '06 #4
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

to**************@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" <df*****@tommyfrench.co.ukwrote in message
news:11**********************@s13g2000cwa.googlegr oups.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
Jul 25 '06 #5
TDC
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

to**************@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" <df*****@tommyfrench.co.ukwrote in message
news:11**********************@s13g2000cwa.googlegr oups.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
>
Jul 25 '06 #6
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

to**************@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" <df*****@tommyfrench.co.ukwrote in message
news:11**********************@s13g2000cwa.googlegr oups.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
Jul 25 '06 #7
Are you sure that the account has write access to the directory and files?
Sounds like it only has read access.

/claes
"dermot" <df*****@tommyfrench.co.ukwrote in message
news:11*********************@h48g2000cwc.googlegro ups.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

to**************@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" <df*****@tommyfrench.co.ukwrote in message
news:11**********************@s13g2000cwa.googlegr oups.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

Jul 25 '06 #8
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" <df*****@tommyfrench.co.ukwrote in message
news:11*********************@h48g2000cwc.googlegro ups.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

to**************@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" <df*****@tommyfrench.co.ukwrote in message
news:11**********************@s13g2000cwa.googlegr oups.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
Jul 25 '06 #9
Please verify both the share permissions and the NTFS permissions. I had a
similar problem and my share permissions were wrong.

Mike Ober.

"dermot" <df*****@tommyfrench.co.ukwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.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" <df*****@tommyfrench.co.ukwrote in message
news:11*********************@h48g2000cwc.googlegro ups.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
>
to**************@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" <df*****@tommyfrench.co.ukwrote in message
news:11**********************@s13g2000cwa.googlegr oups.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

>



Jul 26 '06 #10
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:
Please verify both the share permissions and the NTFS permissions. I had a
similar problem and my share permissions were wrong.

Mike Ober.

"dermot" <df*****@tommyfrench.co.ukwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.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" <df*****@tommyfrench.co.ukwrote in message
news:11*********************@h48g2000cwc.googlegro ups.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

to**************@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" <df*****@tommyfrench.co.ukwrote in message
news:11**********************@s13g2000cwa.googlegr oups.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
Aug 3 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Brett Gerhardi | last post by:
Hi all, I'm having a nightmare with Windows Installer projects and souce control. My situation is that I have a few related windows application / dlls, some generic shared library files and a...
1
by: Rich Miller | last post by:
Previously posted on the VB newsgroup with no replies, so any ideas appreciated. I have written a service application in VB (VS.Net 2003). On start, the service creates an object that...
5
by: Belsam | last post by:
Hi all I need to create a windows service that will wait for a file to be copied somewhere, write it to the database, and then move the file to a storage area. I don't know when the file will...
1
by: Zachariah | last post by:
I created a Windows Service and part of its functionality is to move a PDF file from a location on the service's local drive stInPath (C:\PDF\) to a location on another server stOutPath...
3
by: Amjad | last post by:
Hi, I just wrote a test Windows Service that creates a text file on startup (please see my code below). The file is never created. Protected Overrides Sub OnStart(ByVal args() As String) Dim...
2
by: Jim in Arizona | last post by:
I made up a service that will move files from a folder on the machine that the service is running to a share on another machine. I use a try/catch incase an error is thrown and write that error to...
4
by: Steven De Smet | last post by:
Hello, This is my first post. I searched on the internet for answers but I was unable to solve my problem. So I hope that you guy's can help me with my VB.NET problem I tried to create a...
41
by: pbd22 | last post by:
Hi. I know my windows service works when i run it in debug mode on my dev machine. It also works in release mode on my dev machine. But, when I move the service to a production server, it...
2
by: =?Utf-8?B?RGF2aWQ=?= | last post by:
Hello I'm trying to develop a Windows service, in visual studio 2005, which executes a visual basic script. However, if the script interacts with the file system (as it has to), the script...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.