• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 893
  • Last Modified:

charts won't display consistently

I am using the ASP.NET chart control in my app.  In development mode, it works fine.  When I deploye it to my production site, the image displays as an X (missing image).  If I try over and over, it seems to display about half of the time.  The chart is generated through code.  I have a number of these, and they all behave the same.

I know this is not a lot to go on, but am curious if a setting might be needed.  I have the same entries in my web.config (dev and production).  Tried both File and Session based.  They behave the same.


      <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />

      <add key="ChartImageHandler" value="storage=session;deleteAfterServicing=true;timeout=20;" />
0
No1Coder
Asked:
No1Coder
  • 6
  • 4
1 Solution
 
Gerry BartleySoftware EngineerCommented:
On our application we did the following

<add key="ChartImageHandler" value="storage=file;timeout=100;dir=c:\tempimages\;"/>

However we also had to give rights to Network Service in order to create the images there. It has readonly by default. Might help?
0
 
No1CoderAuthor Commented:
It wuld'n seem to be permissions related if it works some of the time.  I tried file and session based.  Both do the same thing.
0
 
Christopher KileCommented:
Try setting deleteAfterServicing=false and see what happens.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
No1CoderAuthor Commented:
When I set to storage=file, and deleteAfterServicing=false, it seems to work reliably (25 out of 25).  When I set deleteafterservice=false, it works less that half of the time.

When I set to storage=session, it works about 1/3 of the time, regardless of the deleteafter setting.

Seems to be timing issue of some kind. I don't want the files to continue to grow (if DeleteAfter=false), so is there another solution?
0
 
Christopher KileCommented:
Yes, set the chart image type to UseImageLocation, a member of the ImageStorageMode Enumeration, then set the chart's image location property to the local file path that you will use for this purpose; when the page displaying the chart is unloaded, delete the image.  You can also select to use an HTTPHandler; this article includes a section titled
Dynamically Generating Images Using The ChartHttpHandler
which describes how to customize this process, so it may help you if you want to return to trying to keep your image strictly in memory or session.
0
 
No1CoderAuthor Commented:
I added the UseHttpHandler per the article.

It still fails about the same frequency (30%).

<asp:Chart ... ImageStorageMode="UseHttpHandler">

Wasn;t sure I understood your comments about ImageStorageMode.  Thisis handleeled i web.config.  Correct?  Also, when using the HttpHandler, I saw a note saying it does not look at web.config when thisoption is used.
0
 
Christopher KileCommented:
Actually, this is handled in code or markup, not in web.config.  You set the ImageStorageMode="UseImageLocation" and ImageLocation="path to where the image will be placed" on the HTML for the Chart control, or set it in code:

myChart.ImageStorageMode = System.Web.UI.DataVisualization.Charting.ImageStorageLocation.UseImageLocation

myChart.ImageLocation = "path to where the image will be placed"
0
 
No1CoderAuthor Commented:
Is there anything different about setting the path in markup versus using the web.config settings?  Is there a reason to think this will work differently?
0
 
Christopher KileCommented:
Yes.  It worked for me doing it the way I described - I converted an in-house presentation package to use Microsoft Chart when it was still freeware on asp.net, and this is how I save, email, print and embed in PDFs the image of the graphic presentation.  It's the way the examples show how to do it in the examples that I've seen.  Further, while I know a number of things can be set in web.config, I've never tried to set the master defaults for a particular control for all of the application, which might be why I would use web.config - also, I've never seen an example where these parameters are set in web.config.  In short, I have every reason to believe it will work differently.
0
 
No1CoderAuthor Commented:
This seems to work.

Chart1.ImageStorageMode = System.Web.UI.DataVisualization.Charting.ImageStorageMode.UseImageLocation;
Chart1.ImageLocation = "~//temp/chart.png";
Chart1.ImageType = System.Web.UI.DataVisualization.Charting.ChartImageType.Png;
0
 
No1CoderAuthor Commented:
This seems to work.

Chart1.ImageStorageMode = System.Web.UI.DataVisualization.Charting.ImageStorageMode.UseImageLocation;
Chart1.ImageLocation = "~//temp/chart.png";
Chart1.ImageType = System.Web.UI.DataVisualization.Charting.ChartImageType.Png;
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now