asp.net:Invalid temp directory in chart handler configuration [c:\TempImageFiles\]

前端 未结 10 1081
北荒
北荒 2020-12-13 02:31

I am getting this error Invalid temp directory in chart handler configuration [c:\\TempImageFiles\\]. While running my code.

Intially I was getting

相关标签:
10条回答
  • 2020-12-13 03:03

    You need to use a temporary directory that is within the folder hierarchy of your web application. In Windows Azure, you don't have access to c:\TempImages, so that is not going to work.

    I created a quick sample of ASP.Net Charts working in Windows Azure here: http://code.msdn.microsoft.com/azurecharts

    You can still use file storage for the temporary images:

    If you don't want to download the sample, here are the steps to get it working:

    1. In your Solution, create a folder (called TempImages, for example).
    2. Add a file (temp.txt, or whatever) to this folder. The dev tools don't seem to publish empty directories.
    3. Set the image location of your chart to:

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

    4. Add the following to appSettings in your web.config :

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

    5. Make sure the following is in system.web/assemblies :

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

    6. Make sure the following is in 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. Make sure the following is in 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"/>

    The code I uploaded to code.msdn.com should suffice as an example.

    0 讨论(0)
  • 2020-12-13 03:05

    Just create a folder with name 'TempImageFiles' in C drive.

    0 讨论(0)
  • 2020-12-13 03:07

    I had the same issue, my problem was my provider had special folders with write rights, so I changed the TempImagesFile folder to their default folder and it worked.

    In my case the folder with write rights was called upload

    web.config edits:

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

    Hope this can help other too ;)

    0 讨论(0)
  • 2020-12-13 03:14

    try to add this key to your web.config

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

    instead of the default one:

    <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
    
    0 讨论(0)
  • 2020-12-13 03:15

    Check out this answer on the Windows Azure forum: http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/thread/92238582-9445-4d15-a5a7-5f24fd4bf646/.

    0 讨论(0)
  • 2020-12-13 03:15

    Update your app setting to this and see if that fixes your problem

     <appSettings>
        <add key="ChartImageHandler" value="storage=file;timeout=20;deleteAfterServicing=false;privateImages=false" />
        <add key="ChartImageHandler" value="storage=memory;deleteAfterServicing=true;"/>
      </appSettings>

    0 讨论(0)
提交回复
热议问题