因为它正由另一个进程使用广东话访问文件 [英] Cant Access File because it is being used by another process

查看:95
本文介绍了因为它正由另一个进程使用广东话访问文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我从那里来的网络使用DownloadFile WebClient类的方法,下载文件和做一些修改就可以了一个ASP.NET程序。那么我将其保存到另一个文件夹具有独特name.When我收到此错误

I have an ASP.NET program where i am downloading a file from web using DownloadFile method of webClient Class and the do some modifications on it. then i am Saving it to another folder with a unique name.When I am getting this error

该进程无法访问文件D:\研发\ DOTNET \ ABC \ abcimageupload \图像\ TempStorage \ tempImage.jpg',因为它正由另一个进程使用

The process cannot access the file 'D:\RD\dotnet\abc\abcimageupload\images\TempStorage\tempImage.jpg' because it is being used by another process

谁能告诉我怎么解决这个问题。

Can anyone tell me how to solve this.

推荐答案

通常情况下,我认为你的code应该找这样的事情。

Generally, I think your code should looking something like this.

WebClient wc = new WebClient();
wc.DownloadFile("http://stackoverflow.com/Content/Img/stackoverflow-logo-250.png", "Foo.png");
FileStream fooStream;
using (fooStream = new FileStream("foo.png", FileMode.Open))
{
	// do stuff
}
File.Move("foo.png", "foo2.png");

这篇关于因为它正由另一个进程使用广东话访问文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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