Issue: The chart picture is not displayed after you deploy to IIS; results: Some problems encountered during the use of WebChart

Source: Internet
Author: User
Tags file url

Some problems encountered during the use of WebChartApril 30, 2013 ⁄ general ⁄ a total of 4874 characters ⁄ font size small medium big ⁄ comments off

Installation conditions:
1, operating system if it is 2003, then need to SP2 patch
2, the framework needs 3.5, and need to play SP1 patch first.
4. Execute the Mschart.exe file first, this is the language pack for the chart control.
3, then execute Mschartlp_chs.exe, this is the chart control installation file.
5, then execute the Mschart_visualstudioaddon.exe, this is the chart control as an additional tool for vs.

Problems:

1. After dragging and dropping the chart control from the toolbox, the control is always not recognized. First check some of the compilation options for your project and see if you are using the 3.5 option.

2. When the page is executed, tip: Error executing child request for Chartimg.axd.

The Imagestoragemode of the chart control has two options: useHttpHandler and useimagelocation two options. Both of these options are available, but if you are using useHttpHandler, the relevant configuration of the chart in Web. config is correct. With Useimangelocation, a lot of picture files are generated in the file system. If installed properly, the first time you drag and drop a chart control from the toolbox to a page, the configuration associated with that control is automatically added to the Web. config file, including the configuration:

...
<appSettings>
<add key= "Chartimagehandler" value= "storage=file;timeout=20;dir=c:/tempimagefiles/;"/>
</appSettings>

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

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

3, the use of handler, the configuration is the same as above, but when executed, or reported: Error executing child request for Chartimg.axd. This time may wish to httphandlers in the <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 "/>

Modified to:

<add path= "Chartimg.axd" verb= "Get,head,post" type= "System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, version=3.5.0.0, Culture=neutral, publickeytoken=31bf3856ad364e35 "validate=" false "/ >

That is, add the post action in the verb.

4, the use of handler in the development of the way, all OK, graphics can come out, but once deployed to IIS, and then access, you are prompted: the chart handler configuration [c:/tempimagefiles/] in the temporary directory is invalid. Workaround:

Put the configuration file in <add key= "Chartimagehandler" value= "storage=file;timeout=20;dir=c:/tempimagefiles/;"/>

The dir attribute is removed on the OK.

Reference article:

http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/thread/1dc4b352-c9a5-49dc-8f35-9b176509faa1/#page: 1

This article from Csdn Blog, reproduced please indicate the source: http://blog.csdn.net/lastbeachhead/archive/2009/02/16/3896804.aspx

ImageLocation attribute meaning collection for MSChart components in. NET 3.5
In a. NET program/web site, if you want to generate statistical charts/graphs, you can previously use OWC (Office Web components), such as the OfficeXP component OWC10, Office2003 component OWC11. OWC uses the Com-dll method of the calling interface, but the main drawback is that the resulting picture is not beautiful enough "modern".

Now, with the release of. NET 3.5, it has introduced a new MSChart component, which, of course, has been thorough. Net of the.

First, to use this new graphics component, the. NET 3.5 SP1 environment is required.
Download and install the following files, respectively, component installation package, Chinese language pack, vs plugin.
MSChart.exe
Mschartlp_chs.exe
Mschart_visualstudioaddon.exe
There are official documents, but they are now in English.

Second, to get to the point, now to understand the meaning of the imagelocation attribute.
Chart.imagelocation
Namespace: System.Web.UI.DataVisualization.Charting
Assembly: System.Web.DataVisualization (System.web.datavisualization.dll)
In VS2008, the default value is: Chartpic_#seq (300,3)
This seems to be not very good to understand AH: (
Well, let's look at some of the correlation properties.

1, Chart.rendertype
This property determines how the graph generated by MSChart is sent to the client in three ways:
Imagetag, the graph is saved as a temporary file on the server and the URL of the temporary file as the SRC attribute value of the tag in the HTML. The URL rules for this temporary file and how the temporary files are generated can be determined by the ImageLocation property.
binarystreaming, the SRC attribute value of the, tag that does not generate the graphics file on the server will point to another. aspx page that is responsible for generating the drawing.
ImageMap, the actual graphic is not displayed, only the image hot zone (image map) is created.
The default value is Imagetag, which is to generate temporary files on the server side.

2, Chart.imagestoragemode
This property determines how the generated graphics are stored, with two options:
useHttpHandler, the default value that is stored by the HTTP handler for the graphics file into memory or file. But the generated file client is not able to directly over URL access to the, tag of the SRC attribute value shape such as:
chartimg.axd?i=chart_67fdbfec448349e686916b97f1351e90_0.png&amp;g=f96eecccd0334d70b8c9b0702894182b
Does not point to a physical storage location on the server side.
useimagelocation, stored as temporary files on the server at the specified location. The client can get the picture directly through the URL. You can further specify the location of the picture storage directory. The picture file name can be random or fixed.

3, Chart.imagetype
The format of the generated graphics file can be BMG, JPEG, PNG, EMF.

Now back to chart.imagelocation, in fact, it has already mentioned its role, is to determine the graphics temporary file URL rules and how to generate temporary files.
(1), this attribute is only valid at chart.imagestoragemode=useimagelocation.
(2), when Chart.rendertype=imagetag, the graph file will be saved on the server after it is generated. The file format and extension are specified by Chart.imagetype. The file name can be static or dynamically variable. Static is the use of a fixed name, dynamic uses a random name, you can use the "#" tag to choose the GUID or specify a sequence of numbers to determine a unique file name.
(3), the default value chartpic_#seq (300,3) means
(4), imagelocation naming example, assuming chart.imagetype=png
Property values generate graphic file URLs
----------------------------------------------------------------
Chartpic_#seq (300,3) chartpic_000003.png?d155074d-2120-49db-a95c-6a4a61911315
Chartpic CHARTPIC.PNG?27194803-A8A9-4C3E-81A7-5534A279DBE0
Chartpic#noguidparam Chartpic.png
(5), default value Chartpic_#seq (300,3) description
Chartpic_ is a prefix, #SEQ是数字序列, 300 means that up to 300 files are allowed, and 3 for 3 seconds, indicating the time limit for writing warning messages to the event log.

Iii. Web. config Associated configuration item
The configuration in Web. config will only take effect when chart.imagestoragemode=usehttphandler. That is, the configuration in Web. config takes effect when you specify that the graphics file is stored by an HTTP handler.
For example:
<add key= "Chartimagehandler" value= "storage=file;timeout=20;dir=c:/tempimagefiles/;d eleteafterservicing=false ; Webdevserveruseconfigsettings=false "/>
Obviously, C:/tempimagefiles/is the HTTP handler to store the graphics file's directory.
Deleteafterservicing, after the picture is successfully downloaded by the browser, determine whether the server slice is deleted, the default value is False.
Note, however, that if you do not specify deleteafterservicing, the picture will not be stored as a file, it should only be in memory temporarily.
Webdevserveruseconfigsettings, when running in the full trust level environment in the VS development Server, determines whether the resulting picture is saved in memory.

Iv. Note the permissions of the folder
As long as the graphics file is generated on the server, regardless of which directory it is stored in, ASP. NET account is required to have write access to the directory.

Reference:
1, MSChart (. NET 3.5) Official documentation.

Issue: The chart picture is not displayed after you deploy to IIS; results: Some problems encountered during the use of WebChart

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.