Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.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
Asp.net 如何通过站点更新IIS上站点中的文件?_Asp.net_File Upload_Content Management System_Iis 7.5_Filelock - Fatal编程技术网

Asp.net 如何通过站点更新IIS上站点中的文件?

Asp.net 如何通过站点更新IIS上站点中的文件?,asp.net,file-upload,content-management-system,iis-7.5,filelock,Asp.net,File Upload,Content Management System,Iis 7.5,Filelock,好的,我们在IIS中有一个CMS站点,运行在ASP.NET4.0上 用户希望更新站点上的一些图像,但由于这些图像最近已被提供,IIS为它们打开了一个句柄,锁定了文件。这会导致用户在尝试上载文件的更新版本时收到以下错误: The process cannot access the file 'X:\inetpub\wwwroot\sitename\Images\Banner\Temp\5.jpg' because it is being used by another process. Descr

好的,我们在IIS中有一个CMS站点,运行在ASP.NET4.0上

用户希望更新站点上的一些图像,但由于这些图像最近已被提供,IIS为它们打开了一个句柄,锁定了文件。这会导致用户在尝试上载文件的更新版本时收到以下错误:

The process cannot access the file 'X:\inetpub\wwwroot\sitename\Images\Banner\Temp\5.jpg' because it is being used by another process.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.IOException: The process cannot access the file 'X:\inetpub\wwwroot\sitename\Images\Banner\Temp\5.jpg' because it is being used by another process.

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[IOException: The process cannot access the file 'X:\inetpub\wwwroot\sitename\Images\Banner\Temp\5.jpg' because it is being used by another process.]
    System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +14328663
    System.IO.File.InternalDelete(String path, Boolean checkHost) +14293114
    Admin_Settings_EditHomePageBanner.btnSave_Click(Object sender, ImageClickEventArgs e) +1109
    System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +134
    System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +204
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804

在ASP.NET代码中,是否有任何方法以编程方式告诉IIS释放文件的缓存句柄,以便对其进行更新?显然,回收整个IIS过程在这里并不是一个切实可行的方法。

兄弟,我认为你没有正确诊断问题。IIS从来不会以这种方式保留文件,我很确定情况并非如此


您是否一直在代码中处理这些图像,比如使用.Net的位图类修改/显示它们?我认为你自己的代码阻止了这些图像。如果您可以将代码粘贴到这里,我可能会有所帮助。

重新启动是最好和最差的选择。通过部署更新的global.asax,您可以再试一次