文件后HttpPostedFile另存为锁定(LocationOnServer) [英] File is locked after HttpPostedFile SaveAs(LocationOnServer)

查看:216
本文介绍了文件后HttpPostedFile另存为锁定(LocationOnServer)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用的处理器通过SWFUpload的保存上传的文件,我可以节省服务器这样的文件,一个ASPX网页:

I have an aspx webpage that uses as handler to save uploaded files via swfupload I am saving the file on the server like this:

HttpPostedFile uploadedFile = Request.Files["Filedata"];
uploadedFile.SaveAs(LocationOnServer);

问题是,当我保存文件保持锁定的文件(w3wp.exe的),直到我重新启动IIS。 有没有什么办法来释放后保存文件? 谢谢

the problem is that after I save the file the file remain locked (by w3wp.exe) until I restart the IIS. Is there any way to release the file after save? Thanks

推荐答案

我已经处理了过去同样的情况。你需要在域帐户下运行应用程序池。也就是说,在这你的web应用程序运行应设置为域用户运行应用程序池。就在同域用户应该再给予权限,您要上传的文件夹。为了分配一个域用户到应用程序池,选择在IIS应用程序池节点相应的池,右键单击并选择属性。从属性对话框中,选择身份标签,然后选择配置,然后提供一个域帐户。那么你应该在你的文件夹相同的用户授予权限。

I have dealt with the same situation in the past. You need to run your application pool under a domain account. That is, the app pool under which your web application is running should be setup to run as a domain user. That same domain user should then be given permissions to the folder you are trying to upload to. In order to assign a domain user to your application pool, select the appropriate pool from the application pools node in IIS, right click and select properties. From the properties dialog box select the identity tab and choose "Configurable" and then provide a domain account. Then you should give permissions to the same user on your folder.

这篇关于文件后HttpPostedFile另存为锁定(LocationOnServer)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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