【问题标题】:Using Chart in asp.net facing this error "The process cannot access the file.... "在 asp.net 中使用图表遇到此错误“进程无法访问文件....”
【发布时间】:2012-03-19 02:07:32
【问题描述】:

我使用asp.net 中的图表控件制作了一个网站。当负载用户越来越大时,日志中会出现错误。错误详情是这样的,如何解决。

异常详情: 引发了“System.Web.HttpException”类型的异常。 在 System.Web.UI.Page.AsyncPageEndProcessRequest(IAsyncResult 结果) 在 c:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\Temporary 中的 ASP.city_aspx.EndProcessRequest(IAsyncResult ar)

ASP.NET 文件\root\f4f3c9d4\d7501188\App_Web_3mnuhygo.2.cs:line 0 在 System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) System.Web.HttpUnhandledException (0x80004005):引发了“System.Web.HttpUnhandledException”类型的异常。 --->

System.IO.IOException: 进程无法访问文件 'D:\MeeToo\Deploy\Website\tempimg\60101037.png' 因为它正在被

被另一个进程使用。 在 System.IO.__Error.WinIOError(Int32 错误代码,字符串可能全路径) 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) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options,

字符串 msgPath,布尔 bFromProxy) 在 System.IO.FileStream..ctor(字符串路径,FileMode 模式) 在 System.Web.UI.DataVisualization.Charting.Chart.SaveImage(字符串 imageFileName) 在 System.Web.UI.DataVisualization.Charting.Chart.Render(HtmlTextWriter 编写器) 在 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter 作家,ICollection 孩子) 在 System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter 编写器) 在 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter 作家,ICollection 孩子) 在 System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter 编写器) 在 d:\MeeToo\Deploy

中的 ASP.control_locationinfo_ascx._Render_control1(HtmlTextWriter __w, Control parameterContainer)

\Website\control\LocationInfo.ascx:第 14 行 在 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter 作家,ICollection 孩子) 在 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter 作家,ICollection 孩子) 在 System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter 编写器) 在 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter 作家,ICollection 孩子) 在 System.Web.UI.Page.Render(HtmlTextWriter 编写器) 在 System.Web.UI.Page.ProcessRequestMain(布尔 includeStagesBeforeAsyncPoint,布尔 includeStagesAfterAsyncPoint) 在 System.Web.UI.Page.HandleError(异常 e) 在 System.Web.UI.Page.ProcessRequestMain(布尔 includeStagesBeforeAsyncPoint,布尔 includeStagesAfterAsyncPoint) 在 System.Web.UI.Page.ProcessRequest(布尔 includeStagesBeforeAsyncPoint,布尔 includeStagesAfterAsyncPoint) 在 System.Web.UI.Page.PageAsyncInfo.CallHandlersPossiblyUnderLock(Boolean onPageThread)

【问题讨论】:

  • 您好,您的问题解决了吗?

标签: asp.net multithreading microsoft-chart-controls


【解决方案1】:
System.IO.IOException: The process cannot access the file   
'D:\MeeToo\Deploy\Website\tempimg\60101037.png' 
because it is being used by another process.

上面的消息告诉你是什么原因造成的。it is being used by another process.你需要确保没有其他进程访问这个文件(60101037.png)

【讨论】:

  • 我认为问题在于其他 IIS/.NET 进程正在访问该文件。
【解决方案2】:

似乎这也发生在其他一些人身上。他们通过添加为文件提供唯一名称并清除旧文件的代码来修复它,因为新文件当然永远不会被锁定。

<asp:Chart ImageType="Png" runat="server" ID="chartStatComp" Palette="BrightPastel"
ImageLocation="~/CRM/Reports/chartStatComp_#SEQ(100,10)" ImageStorageMode="UseImageLocation"
Width="620" Height="300">

The process cannot access the file error with System.Web.UI.DataVisualization.Charting

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-22
    • 1970-01-01
    • 2021-10-14
    相关资源
    最近更新 更多