再次上传相同的excel表时出错? [英] error while uploading same excel sheet again?

查看:106
本文介绍了再次上传相同的excel表时出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

System.IO.IOException: The process cannot access the file 'F:\Final\IQM SAMPLE WORK - Copy\File3\dotnet.xlsx' because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode) at System.Web.HttpPostedFile.SaveAs(String filename) at System.Web.HttpPostedFileWrapper.SaveAs(String filename) at iqmsampleworks_project.Areas.admin.Controllers.adminController.import(HttpPostedFileBase file, HttpPostedFileBase file1) in f:\Final\IQM SAMPLE WORK - Copy\Areas\admin\Controllers\adminController.cs:line 69

推荐答案

错误意味着什么 它说。您已完成一些文件处理并将文件保持打开状态,而不是关闭它。确保你调用'close'方法并使用块来表示隐藏idisposable的东西。
The error means what it says. You've done some file processing and left the file open, instead of closing it. Make sure you call 'close' methods and use using blocks for things that impliment idisposable.


你需要允许权限覆盖文件,或者你需要给它一个不同的名字你第二次保存它。
You'll need to allow permissions to overwrite the file or you need to give it a different name when you save it the second time.


这篇关于再次上传相同的excel表时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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