Windows服务无法移动文件 [英] Windows Service Cannot Move Files

查看:61
本文介绍了Windows服务无法移动文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在visual studio中编写了一个小的Windows服务应用程序

..net 2003,它监听传入的FTP文件。

这些文件会因重复而随时间覆盖文件名。

但是,只要Windows服务尝试重命名文件(使用

flFile.move(source,destination)),就会出现错误,说访问权限是

被拒绝。


文件在网络上,所以我们虽然本地系统帐户可能没有
无法访问

我们尝试将服务使用的帐户更改为域管理员,但

仍然出现相同的错误。


应用程序运行正常VB窗户形式


任何想法,为什么Windows服务不能这样做。


非常感谢

Dermot法语

解决方案

默认情况下,Windows服务无法访问网络。在w2k和

XP中,您可以使用系统帐户的网络版。


Mike Ober。


dermot < df ***** @ tommyfrench.co.ukwrote in message

news:11 ********************** @ s13g2000cwa.googlegr oups.com ...


我在visual studio中编写了一个小的Windows服务应用程序

.net 2003传入的FTP文件。

由于文件名重复,这些文件会随着时间的推移而覆盖。

但是任何时候windows服务都会尝试重命名文件(使用

flFile.move(来源,目的地))它收到一个错误,说访问是

被拒绝。


文件在网络上,所以我们虽然本地系统帐户可能无法访问


我们尝试将服务使用的帐户更改为域管理员,但

仍然获得相同的错误。


应用程序运行正常,因为VB窗口形式


任何想法,为什么Windows服务不能这样做。


非常感谢

Dermot French



Mike,

我实际上将启动它的帐户更改为域管理员

帐户。它可以看到文件(本地系统无法访问) -

然而它无法移动文件(获取访问被拒绝的消息)?


服务正在win 2003服务器上运行。

任何想法


问候,

Dermot

Michael D. Ober写道:


Windows服务默认情况下无法访问网络。在w2k和

XP中,您可以使用系统帐户的网络版。


Mike Ober。


dermot < df ***** @ tommyfrench.co.ukwrote in message

news:11 ********************** @ s13g2000cwa.googlegr oups.com ...


我在visual studio中编写了一个小的Windows服务应用程序

.net 2003传入的FTP文件。

由于文件名重复,这些文件会随着时间的推移而覆盖。

但是任何时候windows服务都会尝试重命名文件(使用

flFile.move(来源,目的地))它收到一个错误,说访问是

被拒绝。


文件在网络上,所以我们虽然本地系统帐户可能无法访问


我们尝试将服务使用的帐户更改为域管理员,但

仍然获得相同的错误。


应用程序运行正常,因为VB窗口形式


任何想法,为什么Windows服务不能这样做。


非常感谢

Dermot法语


嗨dermot


我认为你正在尝试获取文件,而它们仍在使用

tcp。


你应该允许一些延迟。当文件到达时不要攻击它!


放置一个计时器并每半秒尝试一次。你会看到

一些尝试最终会成功。可以限制数量


尝试并记录可能的不成功....让我知道


- tom


dermot ha scritto:


Mike,

我实际上更改了开始的帐户它到域管理员

帐户。它可以看到文件(本地系统无法访问) -

然而它无法移动文件(获取访问被拒绝的消息)?


服务正在win 2003服务器上运行。

任何想法


问候,

Dermot


Michael D. Ober写道:


Windows服务默认情况下无法访问网络。在w2k和

XP中,您可以使用系统帐户的网络版。


Mike Ober。


dermot < df ***** @ tommyfrench.co.ukwrote in message

news:11 ********************** @ s13g2000cwa.googlegr oups.com ...


我在visual studio中编写了一个小的Windows服务应用程序

.net 2003传入的FTP文件。

由于文件名重复,这些文件会随着时间的推移而覆盖。

但是任何时候windows服务都会尝试重命名文件(使用

flFile.move(来源,目的地))它收到一个错误,说访问是

被拒绝。

>

文件是在网络上,所以我们虽然本地系统帐户可能没有b
$ b我们尝试将服务使用的帐户更改为域管理员,但

仍然有同样的错误。

>

应用程序在VB窗口形式运行良好

>

任何想法,为什么Windows服务不能这样做。

>

很多ks

Dermot法语

>


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

解决方案

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



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


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
>


这篇关于Windows服务无法移动文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆