I have been playing around with the ASP.NET 4.0 Chart Controls for a new web site (Bilvärdet.se – used car price statistics)
When deploying it to IIS7 on my Windows Server 2008 I ran in to a few problems:
1) I did not have .NET 4.0 Framework installed on the server
🙂 It turns out .NET 4.0 Framework is an optional update in Windows Update and for some reason that I could not figure out failed to install (error code: 80200053) Solution that worked: Manually installed it. I had to use a tool that was new to me, the Microsoft Web Platform Installer (Web PI). Seems to be a cool tool to download, install and configure all sorts of software (incl WordPress, Dupral, Joomla) on Windows, will check this out in more detail in the future.
Don’t forget to change the Application Pool for your Web Site/Web Application in IIS Manager to use .NET Framework 4.0
2) Next problem, error message: An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode
This turned out to be a few lines of code in web.config that seems to be needed on my development machine (Windows7 and Visual Studio 2010) but causes problems on IIS7.
Just removed this section from production web.config on server and it worked:
<add path="ChartImg.axd" verb="GET,HEAD,POST"
System.Web.DataVisualization, Version=126.96.36.199, Culture=neutral,
Thanks to Michael Narinsky for pointing this out.
3) Image file directory problems
First error message: Invalid temp directory in chart handler configuration c:\TempImageFiles\
Solution: Changed dir in ChartImageHandler app settings in web.config
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;"/>
Then this error message: The temp directory in chart handler configuration is not accessible c:\xxx\images\
Followed error message suggestion and added access rights to directory (Properties – Security tab) for user NETWORK SERVICE
[Update: Other error message that can appear:
a) “Access to the path ‘C:\xxx\images\charts\chart.png’ is denied.” – this is the same as above, add rights for NETWORK SERVICE
b) “Could not find a part of the path ‘C:\xxx\images\charts\chart.png’.” – make sure directory exists or create it]
4) Charts not rendering with ASP.NET Routing
I’m using ASP.NET 4.0 Routing but this seems to be something Charts are not working well with. Charts are showing up as broken links. If you are using routing, you need to make sure ChartImg.axd is ignored. Add Ignore (or IgnoreRoute) and – this took me quite some time to figure out – make sure you add these before any MapPageRoute or it will not work!
This is what I added in VB.NET, add one line per level in virtual/route folder structure – first line is for root, second line for one subdirectory level, third line for two subdirectory levels.
The line you removed in the httpHandlers sections isn’t needed at all or it has to be translated in some other way?
Invalid temp directory in chart handler configuration c:\TempImageFiles\
Check out the permissions on the User account and ensure these are what you want. Failing which you may get this message no matter what you have put in your web-config file
Thanks for this article, specially for the 3rd error.
Thanks for the articule, i was having trouble with error #2, theese are life saving notes when going to production server
thanks your cooperation ^^
thanks , it works
Chart Control is not working on destination server as in web config file having in
Your 4th error was mine! This article saved my life, thanks for this.
Thanks for the info, also where ever you decide to place the .png file gneration process, make sure that in the managed server environment, IIS_IUSER have written permission to create and destroy the .png charts that are created and rendered to the site.
Also, recommend placing the file in the same file directory tree where the asp.net solution file resides.
OH THANK GOD!! This was driving me INSANE. I cound’t for the life of me figure out why a webform would render a chart correctly in the root but not in a sub/subdirectory.
That said, i’d not just limit the excludes to the chartimg.axd
here’s what i wound up with that works beautifullly
and just for good measure:
Very helpful, saved my day. many many thanks