By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,226 Members | 1,166 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,226 IT Pros & Developers. It's quick & easy.

Windows Service Cannot Move Files

P: n/a
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
Share this Question
Share on Google+
10 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.