Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net Windows服务(文件副本)使用管理员帐户运行,但访问路径被拒绝_Vb.net_Exception_Windows Services_Unauthorized - Fatal编程技术网

Vb.net Windows服务(文件副本)使用管理员帐户运行,但访问路径被拒绝

Vb.net Windows服务(文件副本)使用管理员帐户运行,但访问路径被拒绝,vb.net,exception,windows-services,unauthorized,Vb.net,Exception,Windows Services,Unauthorized,我用vb.net开发了一个windows服务,它监视一个特定的文件夹,当发生文件重命名事件时,将文件复制到另一个文件夹。该服务是在Microsoft Windows 2012[版本6.3.9600]上安装的。 下面是核心代码 Private Sub DoWhenFileRenamed(ByVal Source As Object, ByVal evnt As RenamedEventArgs) . . . FileName = evnt.FullPath.Subs

我用vb.net开发了一个windows服务,它监视一个特定的文件夹,当发生文件重命名事件时,将文件复制到另一个文件夹。该服务是在Microsoft Windows 2012[版本6.3.9600]上安装的。 下面是核心代码

Private Sub DoWhenFileRenamed(ByVal Source As Object, ByVal evnt As RenamedEventArgs)
    .
    .
    .
    FileName = evnt.FullPath.Substring(Len(x) + 1)
    TmpPath = "c:\tmp\"+random name+"\"
    Directory.CreateDirectory(TmpPath)
    File.Copy(evnt.FullPath, TmpPath + FileName, True)
    .
    .
    .
该服务以管理员权限运行,但当我将文件重命名为System.UnauthorizedAccessException时,会出现以下消息:

Access to the path <evnt.FullPath> is denied
对路径的访问被拒绝
谢谢你的帮助