ASP.Net Chart Control On Shared Hosting Environment, Chartimagehandler / Parser Error Problem Solution

ASP.Net Chart Control On Shared Hosting Envronment (Parser Error) - Deployment of Chart Controls On Shared Hosting Environment Properly...
2010-03-13 19:21
Tugberk Ugurlu


[This Article is for those who can manage to run Chart Control on Local Server but not on Web Server]

Chart Control of ASP.Net 3.5 is very handy way to get statictical data as charts. There are variety of ways to display data with Chart Control. Also it is extramely simple to adapt it to your project. But as I hear from so many ASP.Net user nowadays, there might be some problems when it comes to publish it on your web server, especially on shared hosting servers !

After you install the Chart Control, in order to run ASP.Net chart control on your project, you need to configure your web.config file on your root directory which you have already done (I guess !). If you do that properly, you are able to run it on your local server perfectly. But it is not enough for you to be good to go on your web server.

You need to have Chart Control installed on your web server in order to run it on web !

It is easy to do that if you have your own server but for those who have their website files on a shared hosting service, it is a bit hard. But you do not need to beg your hosting provider to make it be installed on server. Only you need to do is to make proper changes on your web.config file and believe me those changes are much more simple than you think ! Of Course, some references is needed to be added to the Bin Folder on your root directory !

Solution :

  1. Follow this directory on windows explorer:

    C:\Program Files\Microsoft Chart Controls\Assemblies

  2. You will see 4 DLL files inside the folder. Two of those files are for Windows Applications and two of them for Web Applications. We need web application dll files so copy the dll files which are named 'System.Web.DataVisualization.Design' and 'System.Web.DataVisualization'

  3. Paste those dll files into the Bin folder on the root directory of your Web Application.

  4. Secondly, open the Web.Config file on the root directory of your web application.
  5. Find the <appSettings> node. You have a key add inside this just like below;

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

    Replace this tag with the new one as below;

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

    Save the changes on your Web.Config file and close it. Now copy the two dll inside the bin folder and replace the Web.Config file on your server with your new Web.Config file.


That's it !

Now you should be able to run the Chart Control on your Web Server without begging your hosting provider :) If you have any problem with this, I recommend you to check the following codes if they exist on your Web.Config file or not;

 

...



  ...

  
    
      
    
  

  ...

  
    
  

  ...



...


  
    
    
  


... 

 



Comments

David_677
by David_677 on Monday, Mar 22 2010 21:23:50 +02:00
I am getting the following error. is The article related to this problem? 

Hi everybody. I installed Cahrt control of ASP:Net and It works fine on local. I made neccessary changes on web.config but When I deploy it to my site I am getting the error ! It says as below;

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load file or assembly 'System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error: 

[No relevant source lines]

Thanks in advance man !
Tugberk
by Tugberk on Monday, Mar 22 2010 21:37:24 +02:00
Hi David_677,

This article is entirely related to your problem and the solution complately sort your problem out !

Tugberk
by Tugberk on Wednesday, Mar 24 2010 12:06:27 +02:00
Also, do not forget the following refister to your page which you use As.Net Chart Control;

<%@ Register Assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
nihan
by nihan on Wednesday, Mar 31 2010 18:54:54 +03:00
I wish you will continue your working
Tugberk
by Tugberk on Thursday, Apr 01 2010 11:38:23 +03:00
What a sweet of you Thanks
Tugberk
by Tugberk on Sunday, May 30 2010 11:00:29 +03:00
Asp.Net 4.0 has came with the feature of bunch chart controls. My advice is find a hosting which supports .NET Framework 4.0 and immigrate your project from ASP.Net 3.5 to ASP.Net 4.0 !

Here is a helpful link !
http://weblogs.asp.net/scottgu/archive/2010/02/07/built-in-charting-controls-vs-2010-and-net-4-series.aspx
bolsson
by bolsson on Monday, Jun 21 2010 14:04:39 +03:00
I immigrated my project to asp.net 4.0 only to find that the difference was the same? i.e. the chart control still registers on the asp page, the only difference being the reference having changed targeting from 3.5.0.0 to 4.0.0.0. Further the web.config is auto updated in the <appSettings> and <httphandlers> sections in the same way as before. Am I doing something wrong?
According to this guy here (see link below) I am not, it is just that MS has decided not to incorporate the chart control by default into the new framework. This due to memory concerns.
http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/thread/973be36b-2771-41d1-b2d1-0112202cf0de
bolsson
by bolsson on Monday, Jun 21 2010 14:06:05 +03:00
I immigrated my project to asp.net 4.0 only to find that the difference was the same? i.e. the chart control still registers on the asp page, the only difference being the reference having changed targeting from 3.5.0.0 to 4.0.0.0. Further the web.config is auto updated in the <appSettings> and <httphandlers> sections in the same way as before. Am I doing something wrong?
According to this guy here (see link below) I am not, it is just that MS has decided not to incorporate the chart control by default into the new framework. This due to memory concerns.
http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/thread/973be36b-2771-41d1-b2d1-0112202cf0de
bolsson
by bolsson on Monday, Jun 21 2010 14:07:26 +03:00
I immigrated my project to asp.net 4.0 only to find that the difference was the same? i.e. the chart control still registers on the asp page, the only difference being the reference having changed targeting from 3.5.0.0 to 4.0.0.0. Further the web.config is auto updated in the <appSettings> and <httphandlers> sections in the same way as before. Am I doing something wrong?
According to this guy here (see link below) I am not, it is just that MS has decided not to incorporate the chart control by default into the new framework. This due to memory concerns.
http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/thread/973be36b-2771-41d1-b2d1-0112202cf0de
bolsson
by bolsson on Monday, Jun 21 2010 14:13:43 +03:00
Ooops, sorry about the multiple updates, they didn't show up the first few time I updated my post. Please delete the superfluous updates this note included.
Tugberk
by Tugberk on Monday, Jun 21 2010 14:16:46 +03:00
Hi bolsson,
Thanks for your replies but one reply is enough I guess

Here is a link for you to get a quick look at on chart control in net freamwork 4: http://www.asp.net/aspnet-4/videos/aspnet-4-quick-hit-chart-control

The exact difference is here; you do not need dll files on your bin folder if you project is under the 4 version of NET. NET Freamwork 4.0 already consists the cart control as built-in. Of course if your hosting firm supports 4.0 version !

Also you will see in my previous post tha there is a link from Scott Guthrie's blog. please review this post;
http://weblogs.asp.net/scottgu/archive/2010/02/07/built-in-charting-controls-vs-2010-and-net-4-series.aspx
bolsson
by bolsson on Monday, Jun 21 2010 14:19:53 +03:00
I am having troubles with a broken chart control link at my new host PowerDNN. my setup is as follows, default chart property settings on the asp page, thus the httphandler in web.config should handle the chart.

It seems that no matter what changes i make to my web.config <appsetting> section on the host server I still get the same image link on the HTML page (see below).

<img id="dnn_ctr418_ViewQuestionnaire_Chart1" src="//temp/ChartPic_000001.png?c4446b47-99ea-4dea-8bbc-d2599f46d4e3" alt="" usemap="#dnn_ctr418_ViewQuestionnaire_Chart1ImageMap" style="height:440px;width:500px;border-width:0px;">

I have no clue what is going on. On my localhost everything works fine???
Tugberk
by Tugberk on Monday, Jun 21 2010 14:24:05 +03:00
On your computer, I mean at t-your local host, everything works perfect because you have installed chart control into your computer before but not in your shared hosting. That's why we are doing those changes. Please be sure you did everything as above and below one especially;

  1. Follow this directory on windows explorer:

    C:\Program Files\Microsoft Chart Controls\Assemblies

  2. You will see 4 DLL files inside the folder. Two of those files are for Windows Applications and two of them for Web Applications. We need web application dll files so copy the dll files which are named 'System.Web.DataVisualization.Design' and 'System.Web.DataVisualization'

  3. Paste those dll files into the Bin folder on the root directory of your Web Application.

bolsson
by bolsson on Tuesday, Jun 22 2010 00:21:20 +03:00
Hi again Tugberk,

Thanks a lot for your input.

I already did copy the two .dll files to the bin folder. Before I did that the chart control gave an error.
Now it does not give an error, just a broken image. When I examine the image and its link with the Google Developer Tools i get the info stated in the above post, i.e the image tag.

And in fact when i check the temp folder at my host I find the newly created Chartpic_000001.png file.
So the image is created correctly and stored in my temp folder.
The image tag that the chart control generates is not correct however. 

My <AppSettings> section of the web.config file states:
<add key="ChartImageHandler" value="storage=file;timeout=20;" />

I have tried changing the storage value to point to memory or the temp folder, but to no avail, the image tag generated is still the same, i.e. src="//temp/ChartPic_000001.png.
I believe it should have been src="/temp/ChartPic_000001.png with only one slash.
Why is the <httphandler> ignored. In my asp code I use default properties in my <asp:chart> tag in order to have the httphandler handle the chart generation.

Is my explanation clear I wonder :-)
By now my hairs are turning gray.
Wondering if it could be a caching issue at my host server?
Tugberk
by Tugberk on Tuesday, Jun 22 2010 08:59:15 +03:00
bolsson, generate your chart and after that go to your source code in your brpwser. find your chart's image and its src should like that;

src
="/ChartImg.axd?i=chart_0_0.png&amp;g=18a2dd14dae047ce87328198e37e4dcb"

It is not like that in your code as far as I got from you.
Tugberk
by Tugberk on Tuesday, Jun 22 2010 09:19:29 +03:00
bolsson,

Also please have a look at this comment of mine which is important
coklow
by coklow on Tuesday, Jun 22 2010 13:10:25 +03:00
Definately imigrate your project to asp.net 4 version if you wanna use charts in a shared hosting ! Aslo it is so easy to use it in Visual Studio 2010 !
bolsson
by bolsson on Tuesday, Jun 22 2010 15:07:33 +03:00
Hi again Tugberk,

Thanks a lot for your help.
As it turns out I had set the imagestoragemode property of the chart to UseImageLocation in my code behind: Chart1.ImageStorageMode = DataVisualization.Charting.ImageStorageMode.UseImageLocation and forgotten all about it.
Changing the imagelocation from:
                Chart1.ImageLocation = Request.ApplicationPath "/temp/ChartPic_#SEQ(300,3)"
To:
                Chart1.ImageLocation = "~/temp/ChartPic_#SEQ(300,3)"

sorted out the problem.

Silliness = waste of everybodies time.
Thanks for your eyes.
Tugberk
by Tugberk on Tuesday, Jun 22 2010 15:15:02 +03:00
I thought you have done that already :) It might be something like that;

imagetype="Png" ImageLocation="~\TempImages\ChartPic_#SEQ(300,3)"
aliasgar
by aliasgar on Wednesday, Jul 07 2010 10:59:08 +03:00
Hello
I tried your way but i am still getting this error

Server Error in '/' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly 'System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error:

Source File: C:\inetpub\wwwroot\qassemhamada.com\wwwroot\khcampaign\web.config    Line: 58

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


Version Information: Microsoft .NET Framework Version:2.0.50727.3607; ASP.NET Version:2.0.50727.3082
aliasgar
by aliasgar on Wednesday, Jul 07 2010 10:59:42 +03:00
Please help me in this as soon as possible..
Tugberk
by Tugberk on Wednesday, Jul 07 2010 11:07:01 +03:00
aliasgar,

Please Click Here to read this review. be sure you do that already. it seems you do not !
aliasgar
by aliasgar on Wednesday, Jul 07 2010 11:47:41 +03:00
I have already added .dll files of MS chart control in my bin.

Check my web config

<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
  <configSections>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>
    <appSettings>
    <add key="ChartImageHandler" value="storage=file;timeout=20;"/>
  </appSettings>
    <connectionStrings>
       

    </connectionStrings>
    <!--<pages enableEventValidation="true"/> -->
    <system.web>
    <pages>
       <controls>
          <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
         <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
       </controls>
     </pages>
        <!--
            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="true">
            <assemblies>
        <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="System.Web.DynamicData, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies>
        </compilation>
        <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
        <httpHandlers>
      <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 verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha"/>-->
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
        </httpHandlers>
    <httpModules>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </httpModules>
        <!--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>-->
        <customErrors mode="Off">
        </customErrors>
    </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
      <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </modules>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated" />
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
        type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd"
        preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.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=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      <remove name="ChartImageHandler"/>
      <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"/>
    </handlers>
  </system.webServer>
    <system.net>
     
    </system.net>
</configuration>

Tugberk
by Tugberk on Wednesday, Jul 07 2010 11:55:40 +03:00
the problem is wit your dll files. nothing wrong with your web.config file. be sure that the dll files were healthly passed to server.
aliasgar
by aliasgar on Wednesday, Jul 07 2010 12:12:43 +03:00
it says this
Could not load file or assembly 'System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
aliasgar
by aliasgar on Wednesday, Jul 07 2010 12:14:06 +03:00
sorry i have posted wrong
    <assemblies>
        <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="System.Web.DynamicData, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies>

This is in my web config
Tugberk
by Tugberk on Wednesday, Jul 07 2010 12:19:13 +03:00
That's what I say ! the problem is with your assembly. delete them on your server, an upload them again be sure that you have added the right ones into your bin folder. be through ! do not overlook anything. It still doesn't work, contact with your hosting firm.
Tugberk
by Tugberk on Wednesday, Jul 07 2010 12:23:52 +03:00
here it is ! I figured out now;

remove this from your assembleis;

<add assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

I should work after that
aliasgar
by aliasgar on Wednesday, Jul 07 2010 12:27:56 +03:00
i have remove that assemblies but now it is giving me this error

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load file or assembly 'System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error:

[No relevant source lines]

Source File: none    Line: 0

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


Version Information: Microsoft .NET Framework Version:2.0.50727.3607; ASP.NET Version:2.0.50727.3082

walter
by walter on Saturday, Aug 07 2010 11:15:14 +03:00
Use Asp.NET 4.0 for chart control. it is so much easier
Mehmet
by Mehmet on Wednesday, Nov 24 2010 23:14:37 +02:00
Çözüm için teşekkür ederim eline sağlık. Çok faydalı oldu bu yazı. Kolay gelsin.
Mehmet
by Mehmet on Wednesday, Nov 24 2010 23:24:51 +02:00
By the way I suppose that everyone who apply this solution would have some problems about permissions of chart images that needs a temparory file. Here is the solution:

Chance the code line at the web.config by that:

<

add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\windows\temp\;"/>
Tugberk
by Tugberk on Thursday, Nov 25 2010 10:37:05 +02:00
hi mehmet,

no problem. But consider immigrating your application from 3.5 to 4.0 You will see that chart control won't be a problem on asp.net 4.0. BTW, thanks for the patch. The problem is related to your server. the code works just fine for me on my shared hosting account.
eth
by eth on Friday, Dec 10 2010 03:55:10 +02:00
thanks for this post! you solved my problem.. :D
Tugberk
by Tugberk on Saturday, Dec 11 2010 14:01:21 +02:00
[quote]thanks for this post! you solved my problem.. :D[/quote]
I'm glad it helped...
nihan
by nihan on Tuesday, Feb 15 2011 22:29:57 +02:00

great article :))

D1
by D1 on Monday, Feb 28 2011 08:49:16 +02:00

u r gr8 guy, worked perfectly

D1
by D1 on Monday, Feb 28 2011 08:50:16 +02:00

u r gr8 guy, worked perfectly

Tugberk
by Tugberk on Monday, Feb 28 2011 11:10:39 +02:00

@D1 that's your greatness man :)

kamal
by kamal on Tuesday, Mar 01 2011 11:30:08 +02:00

i got an error '

The temp directory in chart handler configuration is not accessible [D:\Hosting\7476079\html\].'

can you fixed the problem ?

 

thanks 

kamal

 

Tugberk
by Tugberk on Tuesday, Mar 01 2011 17:10:25 +02:00

@kamal did you check that you have write access on  the directory?

kamal
by kamal on Thursday, Mar 03 2011 06:25:13 +02:00

i did give write access on the directory, and now i got another error error like below :

Server Error in '/' Application.

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. 

Exception Details: System.Security.SecurityException: Request failed.

Source Error: 

 

[No relevant source lines]

 

can you help me?

Tugberk
by Tugberk on Thursday, Mar 03 2011 10:49:57 +02:00

This is releated to your trust level. Please check : http://msdn.microsoft.com/en-us/library/wyts434y.aspx

but this is a tricky part. you could be vaulnerable after that.

Tugberk
by Tugberk on Thursday, Mar 24 2011 00:35:23 +02:00

@Bhowmik

please make use that your chart control has the properties as below;

imagetype="Png" ImageLocation="~\TempImages\ChartPic_#SEQ(300,3)"

and check the appSetting Key whose name ChartImageHandler and it should contain the values like below;

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

Also, the problem could releate to your hosting provider. you should try to contact them and inform about the situation if it is not working after you do everthing by the book.

Tugberk
by Tugberk on Thursday, Mar 24 2011 10:53:52 +02:00

@Bhowmik

give the write permission to temp folder for IIS_WPG and NETWORK SERVICE and try again.

Jibran
by Jibran on Monday, May 02 2011 19:07:33 +03:00

hank you very much for your article.

it helped me a lot.

But after making advised changes, i got the error which says something like "asp.net needs does not have the write access... " but I couldn't grant rights as it is shared free hosting.

then i again googled and found one comment very useful in the following thread: http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/thread/92238582-9445-4d15-a5a7-5f24fd4bf646/ 

 

thanks again for your help.

 

keep up the good work...

 

 

tugberk
by tugberk on Monday, May 02 2011 20:37:37 +03:00

@jibran thanks. happy that it helped. please also see the 5th item on the solution list above on the post. It gives you the config changes in order not to deal with write access.

Daniel
by Daniel on Sunday, May 08 2011 00:53:04 +03:00

 

I am trying to use the microsoft Charting control on a shared server and have inserted the following:  

<add key="ChartImageHandler" value="Storage=file;Timeout=20;url=~/temporary/;"/>

 

 

And in the webpage I have:

Chart1.ImageStorageMode = ImageStorageMode.UseImageLocation;

Chart1.ImageLocation = "~/temporary/ChartPic_#SEQ(300,3)";

Chart1.ImageType = ChartImageType.Png;

 

on the aspx page:

<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>

 

Please help as i am very stuck and getting frustrated that this doesnt work.

 

Tugberk
by Tugberk on Sunday, May 08 2011 23:29:26 +03:00

@Daniel

what is the error you are getting?

try to replace <add key="ChartImageHandler" value="Storage=file;Timeout=20;url=~/temporary/;"/> with <add key="ChartImageHandler" value="storage=file;timeout=20;"/>

and also replace Chart1.ImageLocation = "~/temporary/ChartPic_#SEQ(300,3)"; with Chart1.ImageLocation = "~\TempImages\ChartPic_#SEQ(300,3)";

 

Daniel
by Daniel on Monday, May 09 2011 20:53:35 +03:00

If i replace <add key="ChartImageHandler" value="Storage=file;Timeout=20;url=~/temporary/;"/> with <add key="ChartImageHandler" value="storage=file;timeout=20;"/>

 

I get an error sta ting:

The temp directory in chart handler configuration is not accessible [D:\Hosting\7796030\html\]

I think because its on a shared server.  Thats why i created a new folder named "temporary" with full read and write permissions and pointed the chart image location to that folder with the previous tag <add key="ChartImageHandler" value="Storage=file;Timeout=20;url=~/temporary/;"/>.  

 

The overall problem:

The problem I am getting is that if i point the chart image location to the folder i created named "temporary", it does not produce the graph image instead it produces an empty image with only a title.  I also believe I have the correct dlls in my bin folder,  'System.Web.DataVisualization.Design' and 'System.Web.DataVisualization'.

 

JM Belmonte
by JM Belmonte on Wednesday, Jun 01 2011 03:52:26 +03:00

Nice job dude . . .

erleroadself
by erleroadself on Tuesday, Jun 21 2011 09:02:30 +03:00


Thank you for making the effort and spreading this information with all of us. It was indeed very useful and informative while being straight forward and to the point.

ishtiyaq
by ishtiyaq on Wednesday, Jun 29 2011 03:53:24 +03:00

about the charting control. Still have the same problem after following the direction on the forum. My web config wont work on godaddy server. Please help me.

George
by George on Wednesday, Jan 11 2012 21:50:37 +02:00

When I run the page that holds my charts, a copy of the chart is saved as a png file. Obviously I can't let this keep on happening! could you point me to the code or attribute that's doing this?  Incidentally you blog is great, it helped me out of a great hole.

anders
by anders on Tuesday, Feb 14 2012 12:46:08 +02:00

Hi,
I'm running vs 2010 and are using the chart control. My public server runs 3.5 and hence I've trouble with the chart control..
I've follwed your guide but I get the following error message:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly 'System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error:


Line 34:         <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Line 35:         <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Line 36:         <add assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Line 37:         <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Line 38:       </assemblies>

Source File: \\172.21.204.204\webvol18\np\0kqf3r1zmk1un31\andersmarcusson.com\public_html\website7\web.config    Line: 36

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.


WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3625; ASP.NET Version:2.0.50727.3634


When i remove the datavisualization line (assembly) from the web.config file and restart the web server I get the following error:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'WebApplication21.WebForm1'.

Source Error:


Line 1:  <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication21.WebForm1" %>
Line 2: 
Line 3:  <%@ Register assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>

Source File: /website7/webform1.aspx    Line: 1


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3625; ASP.NET Version:2.0.50727.3634


I'm lookign forward to your reply.
Best regards
Anders

snehith
by snehith on Monday, Jun 11 2012 22:46:35 +03:00

Hi i made the changes as yo said and now i am not getting run time error but when i try to view my chart page i am being asked authentication required page??May i know why i am getting this page.I also tried to login with username and password but it couldnt login and when i click cancel iam getting this msg

You are not authorized to view this page

You do not have permission to view this directory or page using the credentials that you supplied.

Please try the following:

  • Contact the Web site administrator if you believe you should be able to view this directory or page.
  • Click the Refresh button to try again with different credentials.

HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials.
Internet Information Services (IIS)


Technical Information (for support personnel)

  • Go to Microsoft Product Support Services and perform a title search for the words HTTP and 401.
  • Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled AuthenticationAccess Control, and About Custom Error Messages.

Zodiaxx
by Zodiaxx on Wednesday, Sep 26 2012 07:50:54 +03:00

Hi,i used .NET 4.0, and created my chart in VS 2010. i have followed all the instructions above but when i try to display my chart, i get the error:

------------------------------------------------------------

Compiler Error Message: CS0433: The type 'System.Web.UI.DataVisualization.Charting.DataPoint' exists in both 'c:\WINDOWS\assembly\GAC_MSIL\System.Web.DataVisualization\3.5.0.0__31bf3856ad364e35\System.Web.DataVisualization.dll' and 'c:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\System.Web.DataVisualization\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.DataVisualization.dll'

Source Error:

Line 505:        

Line 506:        [System.Diagnostics.DebuggerNonUserCodeAttribute()]

Line 507:        private global::System.Web.UI.DataVisualization.Charting.DataPoint @__BuildControl__control8() {

Line 508:            global::System.Web.UI.DataVisualization.Charting.DataPoint @__ctrl;

----------------------------------------

please help out.

Waqas Chaudhry
by Waqas Chaudhry on Friday, Apr 26 2013 14:27:17 +03:00

This is a very help ful tutorial, it has solved my problem. Thanks a lot for sharing such a helpful material.

Khaled Kokah
by Khaled Kokah on Saturday, Sep 14 2013 13:02:20 +03:00

Dude you really saved my life! You are simply amazing!

A lot of people just said it won't work on shared hosting but with this method IT WORKED like a charm. For those who struggle, just make sure you put the dll files in the BIN folder & put all the chart related stuff in the web.config file & then create the TEMP Folder ( name it as in your web.config file ) and set the permission to Read/Write.

Thanks again buddy,