The .net charting controls are advertised as being built into .net 4.0. However, they do not work in Visual Studio 2010 Pro or Visual Web Developer 2010 Express. I get the error, Syste开发者_运维问答m.Web.HttpException: Error executing child request for ChartImg.axd.
That sounds like the message from .net 3.5 if charting wasn't set up correctly. But the bottom of the same page says, "Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1"
Does anyone know why this doesn't work?
The charting dll's are included in 4.0. However, you still have to configure charting in your app web.config if you want to use it. I spent an inordinate amount of time studying this, based on statements made in this blog post,
http://weblogs.asp.net/scottgu/archive/2010/02/07/built-in-charting-controls-vs-2010-and-net-4-series.aspx
"You can use this control without having to register or wire-up any configuration file entries."
I emailed Scott and received the following answer. Hope this may help someone:
From: Scott Guthrie [mailto:scottgu@microsoft.com]
Sent: Tue 6/15/2010 10:19 PM
To: Karen xxxxx
Subject: RE: Built-in .Net 4.0 Charting Controls Require Web.Config Updates
Hi Karen,
Sorry about that - there was a late change that we made that ended up requiring that the charting controls have some configuration added to web.config to work. This was done to avoid us loading the assembly unnecessarily (which increases memory) for cases where it is not being used.
Sorry for the confusion,
Scott
It still needs the following in the httpHandler section in web.config.
<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" />
精彩评论