gpt4 book ai didi

asp.net:图表处理程序配置中的临时目录无效 [c:\TempImageFiles\]

转载 作者:行者123 更新时间:2023-12-01 16:18:48 25 4
gpt4 key购买 nike

我收到此错误 图表处理程序配置中的临时目录无效 [c:\TempImageFiles\]。运行我的代码时。

最初我遇到了No http handler was found for request type ‘GET’ error,我通过引用no http handler解决了这个问题。

但是现在我收到了上述错误错误的详细信息是

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.DirectoryNotFoundException: Invalid temp directory in chart handler configuration [c:\TempImageFiles\].

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.

此错误的 stackTrace

[DirectoryNotFoundException: Invalid temp directory in chart handler configuration [c:\TempImageFiles\].]
System.Web.UI.DataVisualization.Charting.ChartHttpHandlerSettings.Inspect() +851
System.Web.UI.DataVisualization.Charting.ChartHttpHandlerSettings.ParseParams(String parameters) +1759
System.Web.UI.DataVisualization.Charting.ChartHttpHandlerSettings..ctor(String parameters) +619
System.Web.UI.DataVisualization.Charting.ChartHttpHandler.InitializeParameters() +237
System.Web.UI.DataVisualization.Charting.ChartHttpHandler.EnsureInitialized(Boolean hardCheck) +208
System.Web.UI.DataVisualization.Charting.ChartHttpHandler.EnsureInstalled() +33
System.Web.UI.DataVisualization.Charting.Chart.GetImageStorageMode() +57
System.Web.UI.DataVisualization.Charting.Chart.Render(HtmlTextWriter writer) +257
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +144
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +583
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +91
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +410
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +118
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +489
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +84
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +713
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +144
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +583
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +91
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +91
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +410
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +118
System.Web.UI.Control.Render(HtmlTextWriter writer) +60
System.Web.UI.Page.Render(HtmlTextWriter writer) +66
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +144
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +583
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +91
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7761

谁能告诉我如何解决这个问题...我应该手动创建一个临时目录还是我应该做什么...

<小时/>

嗨,斯玛克斯,我检查了一下..他们要求我改变

From   
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />

To
<add key="ChartImageHandler" value="storage=file;timeout=20;" />

在网络配置文件中...

但是我的网络配置中没有这一行

我只有这个来定义图表

<add name="ChartImg" verb="*" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler,     System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"  />
<add name="ReportViewer" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler,Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

我现在该怎么办......

最佳答案

您需要使用 Web 应用程序文件夹层次结构内的临时目录。在 Windows Azure 中,您无权访问 c:\TempImages,因此这不起作用。

我在此处创建了在 Windows Azure 中工作的 ASP.Net Charts 的快速示例: http://code.msdn.microsoft.com/azurecharts

您仍然可以使用文件存储来存储临时图像:

如果您不想下载示例,请按照以下步骤使其正常运行:

  1. 在您的解决方案中,创建一个文件夹(例如,名为 TempImages)。
  2. 将文件( temp.txt 或其他文件)添加到此文件夹。开发工具似乎没有发布空目录。
  3. 将图表的图像位置设置为:

    ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)"

  4. 将以下内容添加到 web.config 中的 appSettings 中:

    <add key="ChartImageHandler" value="Storage=file;Timeout=20;Url=~/tempImages/;"/>

  5. 确保以下内容位于 system.web/assemblies 中:

    <add assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

  6. 确保以下内容位于 system.web/httpHandlers 中:
    <add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>

  7. 确保以下内容位于 system.webServer/handlers
    <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

我上传到 code.msdn.com 的代码应该足以作为示例。

关于asp.net:图表处理程序配置中的临时目录无效 [c:\TempImageFiles\],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2660606/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com