none
error: Invalid temp directory in chart handler configuration [c:\TempImageFiles\]

    Question

  • My charts are run fine in my XP VS2008 environment.  But when I deploy to the Window 2003 server, it gave me an error: 

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



    We already installed .net 3.5 SP1 and the new charts controls on the server.  Is there anything else we need to set?

    Many thanks


    Learning Sharepoint
    Monday, December 29, 2008 10:03 PM

Answers

  • I found a solution in this forum.  I changed the web config as:

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

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


    then it work on the IIS server. 

    Many thanks for all of the help.

    Learning Sharepoint
    • Marked as answer by Sirn Tran Tuesday, December 30, 2008 5:29 PM
    Tuesday, December 30, 2008 5:29 PM

All replies

  • Are you certain your asp.net account can write to that directory? Do you get an exception if you add this to your Page_Load handler?

    File.CreateText(@"C:\TempImageFiles\test.txt");


    http://blogs.msdn.com/magreer
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, December 30, 2008 1:52 AM
  • I found a solution in this forum.  I changed the web config as:

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

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


    then it work on the IIS server. 

    Many thanks for all of the help.

    Learning Sharepoint
    • Marked as answer by Sirn Tran Tuesday, December 30, 2008 5:29 PM
    Tuesday, December 30, 2008 5:29 PM
  • thanks for the fix Sirn. works great for me.
    Monday, November 02, 2009 6:44 PM
  • Hey...Thank you ... It worked like charm....
    Tuesday, December 08, 2009 6:21 AM
  • I found a solution in this forum.  I changed the web config as:

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

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


    then it work on the IIS server. 

    Many thanks for all of the help.

    Learning Sharepoint


    I don't have this in my web config file:

    here is my web config file

    <?xml version="1.0"?>
    
    <configuration>
    
    
      <configSections>
       <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
         <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
         <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
         </sectionGroup>
        </sectionGroup>
       </sectionGroup>
      </configSections> 
    
     
      <system.diagnostics>
        <trace>
          <listeners>
            <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
              name="AzureDiagnostics">
              <filter type="" />
            </add>
          </listeners>
        </trace>
      </system.diagnostics>
      <appSettings/>
      <connectionStrings/>
     
      <system.web>
        <!-- 
          Set compilation debug="true" to insert debugging 
          symbols into the compiled page. Because this 
          affects performance, set this value to true only 
          during development.
        -->
        <compilation debug="false">
    
         <assemblies>
          <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
          <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
          <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
         </assemblies>
    
        </compilation>
        <!--
          The <authentication> section enables configuration 
          of the security authentication mode used by 
          ASP.NET to identify an incoming user. 
        -->
        <authentication mode="Windows" />
        <!--
          The <customErrors> section enables configuration 
          of what to do if/when an unhandled error occurs 
          during the execution of a request. Specifically, 
          it enables developers to configure html error pages 
          to be displayed in place of a error stack trace.
    
        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
          <error statusCode="403" redirect="NoAccess.htm" />
          <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    
       <pages>
        <controls>
         <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
         <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
         <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </controls>
       </pages>
    
       <httpHandlers>
        <remove verb="*" path="*.asmx"/>
        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
        <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"/>   
       </httpHandlers>
       <httpModules>
        <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
       </httpModules>
    
      </system.web>
    
      <system.codedom>
       <compilers>
        <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
             type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
         <providerOption name="CompilerVersion" value="v3.5"/>
         <providerOption name="WarnAsError" value="false"/>
        </compiler>
       </compilers>
      </system.codedom>
      
      <!-- 
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0. It is not necessary for previous version of IIS.
      -->
      <system.webServer>
       <validation validateIntegratedModeConfiguration="false"/>
       <modules>
        <remove name="ScriptModule" />
        <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
       </modules>
       <handlers>
        <remove name="WebServiceHandlerFactory-Integrated"/>
        <remove name="ScriptHandlerFactory" />
        <remove name="ScriptHandlerFactoryAppServices" />
        <remove name="ScriptResource" />
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
           type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
           type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <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" />
        <add key="ChartImageHandler" value="storage=file;timeout=20;" />
       </handlers>
      </system.webServer>
    
      <runtime>
       <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
         <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
         <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
        </dependentAssembly>
        <dependentAssembly>
         <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
         <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
        </dependentAssembly>
       </assemblyBinding>
      </runtime>
    
    </configuration>
    
    I too have the same error. What should I have to do now...

    Sunday, April 18, 2010 4:53 AM
  • You need to change the line <appSettings />

     to

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

     

    Be aware that the application will need write access to your project folder!

    • Edited by woodbase Wednesday, April 21, 2010 9:52 PM Forgot something
    Wednesday, April 21, 2010 9:50 PM
  • I guess this worth an explanation why omitting  the dir attribute works, its because it uses the url attribute instead, and that url attribute has a default value of "~/"
    Monday, September 06, 2010 1:44 AM
  • Follows the below steps to solve this issue:

    we need to add two references to our Web.config file. The first, we will add inside the <system.web><httpHandlers></system.web></httpHandlers> tags. Locate these tags and add the following reference:

    <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"/>

     

    The second step, we will add inside the <appsettings></appsettings> tags. Locate these tags and add the following reference:

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

    Monday, January 31, 2011 12:02 PM
  • Sometimes it doesnt allow to create file even you remove dir=c:\TempImageFiles\; values.

    I found a way to work it.

    If you change storage attribute from file to memory then it works.

    Of course you should think about the the usage of memory.

    So change <add key="ChartImageHandler" value="storage=memory;timeout=20;dir=c:\TempImageFiles\;"/> workded for me.

    Thanx...

    • Proposed as answer by Chaman Saini Thursday, January 30, 2014 3:05 AM
    Monday, March 28, 2011 4:34 PM
  • Sorry abit late.  I got the same problem using ASP.NET 4 when deploying to a commercial server like godaddy.com

    Surprisingly it looks like each application has its own unique dilemma.  All the solution that you have been proposed here works if I used in mix.

    Initially after modifying the chart itself by inserting ImageStorageMode="UseHttpHandler"> as in this snip

    <asp:Chart ID="Chart1" runat="server" ImageLocation="~/tempimagefiles/ChartPic_#SEQ(300,3)" DataSourceID="SqdsFilteredWheatData"
                            style="margin-bottom: 0px" Width="527px" ImageStorageMode="UseHttpHandler">
            <Series>

    and applying the suggestion of using memory instead of file as in " storage=file to storage=Memory" as in
     

    <appSettings>
            <add key="ChartImageHandler" value="storage=memory;timeout=20;"/>
         </appSettings>. 

    It did not work.  So I add the RenderType="Bynary Streaming" in to the  asp chart.  It works but the graph is not a graph but bynary streams. 

    Then I delete the RenderType=Bynary Streaming from the <asp:Chart codes.  This time it is working like a charm.  Even when I modify the web config by adding the URL like this, it is still work.

     <appSettings>
            <add key="ChartImageHandler" value="storage=memory;timeout=20;url=~/tempimagefiles/;"/>
         </appSettings>

     Why it works only to toggle on and then off with RenderType="BynaryStreaming"?  I do not know.  It looks like a mystery to me. By the way the account on godaddy use IIS7.

    • Proposed as answer by itsuresh Thursday, November 21, 2013 5:50 AM
    Wednesday, April 20, 2011 11:09 PM
  •  

    Thanks a lot Daniel.........

    I am a newbie in .Net area.........and trying to develop an application with charts and graphs.......ur solution worked for me...

    <appSettings>
            <add key="ChartImageHandler" value="storage=memory;timeout=20;url=~/tempimagefiles/;"/>
         </appSettings>

    when I removed url thing and kept file as storage, it did not work. But when I tried your solution, it worked perfectly..........

     

    Anil

     

    Friday, April 29, 2011 12:32 AM
  • thank you very much...

    storage=memory... helped me a lot...

    Monday, May 02, 2011 4:09 PM
  • just change the storage to memory if you dont want to create physical folder as temp for generated pictures.
    Mostafa Arafa Elzoghbi
    Thursday, May 19, 2011 9:46 PM
  • Thank you, storage=memory really is the simpliest and best solution.
    Monday, July 11, 2011 5:37 PM
  • If you are trying to deploy to Azure for example, just changing storage=memory will fail at deployment.

    First you need to add the line deleteAfterServicing=true; in

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

     

    One thing that requires to deploy it to Windows Azure is to ensure that set the “Copy Local” of System.Web.DataVisualization assembly to True.

    Friday, December 09, 2011 12:26 AM
  • Thank you very very much....u have really given paracetamol for my headache by this solution.....
    Tuesday, December 27, 2011 10:52 AM
  • Are you certain your asp.net account can write to that directory? Do you get an exception if you add this to your Page_Load handler?

    File.CreateText(@"C:\TempImageFiles\test.txt");


    http://blogs.msdn.com/magreer
    This posting is provided "AS IS" with no warranties, and confers no rights.

    Thanks!  When I went to check the permissions I found that the directory was not even created.
    Friday, May 18, 2012 5:09 PM
  • Thanks....This was realy helpful... 
    Wednesday, August 22, 2012 11:14 AM
  • Changing "storage" attribute from "file" to "memory" worked like magic. Thanks a million.

    Ibangajnr

    Wednesday, September 12, 2012 8:37 AM
  • This makes sense if you are hosting on a third party server like godaddy where you dont have much access to folder rights. Worked for me. Thanks.

    RDG

    Thursday, October 11, 2012 3:23 AM
  • For my case, the problem was solved based on a Stackoverflow post:

    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. ImageStorageMode="UseImageLocation"

    Hong

    Monday, November 26, 2012 2:28 AM
  • your Code working fine....In godaddy for my hosting project I got same error,after using your code its working fine.

    <asp:Chart ID="Chart1" runat="server" ImageLocation="~/tempimagefiles/ChartPic_#SEQ(300,3)" DataSourceID="SqdsFilteredWheatData" 
                            style="margin-bottom: 0px" Width="527px" ImageStorageMode="UseHttpHandler">
            <Series>

    <appSettings>
            <add key="ChartImageHandler" value="storage=memory;timeout=20;"/>
         </appSettings>. 

    Thursday, November 21, 2013 5:49 AM