简体   繁体   English

文件/文件夹已在使用中,重命名,删除问题? C#IIS

[英]file/folder is already in use, renaming,deletion problem ? c# iis

I am trying to renme a file/folder, when i try to rename a file, i got an error, file is already in use, it is just my guess that it is caused by w3wp.exe iis process? 我正在尝试重命名文件/文件夹,当我尝试重命名文件时,出现错误,文件已在使用中,只是我猜测它是由w3wp.exe iis进程引起的? some time its says, access to the path is denied, although the file does exist, and there are no special permission, i have all the permission to copy/delete/move and everything for the file/folder. 一段时间,它说,访问路径被拒绝,尽管该文件确实存在,并且没有特殊权限,但我拥有复制/删除/移动的所有权限以及文件/文件夹的所有内容。 How to fix this problem. 如何解决此问题。

the folder contains jpeg files. 该文件夹包含jpeg文件。 this happen: when i copy a file then try to rename it. 发生这种情况:当我复制文件然后尝试重命名它。 this happen: when i rename a file then try to delete it. 发生这种情况:当我重命名文件然后尝试将其删除。 what i mean to say is that it happen when i already use a file operation then for second time it gives me this error :( this is the error: The process cannot access the file 'C:\\images\\audio-aif-old.png' because it is being used by another process. 我的意思是,当我已经使用文件操作然后第二次出现此错误时,它将发生此错误:(这是错误: 进程无法访问文件'C:\\ images \\ audio-aif-old。 png”,因为它正在被另一个进程使用。

file.move(source,destination);

i am using C#. 我正在使用C#。 iis 6, asp.net. IIS 6,asp.net。

Directly , ans is no. 直接地,ans不是。 But you can delete old copy and create a new copy. 但是您可以删除旧副本并创建新副本。 See this. 看到这个。 http://www.aspnettutorials.com/tutorials/file/file-renfile-aspnet2-csharp.aspx http://www.aspnettutorials.com/tutorials/file/file-renfile-aspnet2-csharp.aspx

Some other program must relinquish the file. 其他一些程序必须放弃该文件。 If you've written a program that's still running then that must be shut down. 如果您编写的程序仍在运行,则必须将其关闭。 If the file is currently open for writing you must also ensure that it's been appropriately closed. 如果文件当前处于打开状态以供写入,则还必须确保已正确关闭该文件。 Try creating another file and see if you have the same problem with that one. 尝试创建另一个文件,看看该文件是否存在相同的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM