CrystalReportViewer does not display Charts - crystal-reports

My CrystalReportViewer won't display the charts in my Crystal Report. I get a red X.
I am using C# and MVC. I've read somewhere that I might need a virtual path to the image folder, but I am not really sure what that means as my chart is embedded in the report... Maybe I am missing something. Can anyone elaborate?

OK. I figured it out... MVC, like I said, is processing the route rather than letting the CrystalImageHandler handle it. So here are the steps to make MVC and Crystal ReportViewer display images work.
Read this link and follow the web.config instructions. Make sure all the assemblies point to version 12. You will actually need to install the Crystal Runtime and or Crystal to get the latest assembly versions.
Add this line to your global.asax file to ignore the route of the CrystalImageHandler:
routes.IgnoreRoute("{*allaspx}", new { allaspx = #".*(CrystalImageHandler).*" });

I had a similar problem with crystal reports imbedded with chart / graphs. Using MVC3 framework and crystal report runtime v10
Add the following lines to Web.config
<appSettings>
<!-- For Crystal reports to render dynamic images (eg. charts, graphs)-->
<add key="CrystalImageCleaner-AutoStart" value="true" />
<add key="CrystalImageCleaner-Sleep" value="60000" />
<add key="CrystalImageCleaner-Age" value="120000" />
</appSettings>
<system.web>
<httpHandlers>
<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</httpHandlers>
</system.web>
Add this in the method RegisterRoutes in Globalasax
/*Added for Crystal reports*/
routes.IgnoreRoute("{*allaspx}", new { allaspx = #".*(CrystalImageHandler).*" });

Copy pg32conv.dll and sscsdk80.dll to Windows\System32.

i am also facing same problem while create my crystal report with chart(graphical representation ) , i am unable to get image of chart then
i add some code in web.config file
below the <appSettings></appSettings> tag
we have a tag like
<httpHandlers> </httpHandlers>
check we are having the code in between above taghttphandlers,
<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
if it is there then we definetly get image of chart or bar what ever
if it is not there plz add the code like above k
i hope this is useful to all
thanks.

Related

AjaxControlToolkit 7.0123 breaks VS2012 Web Application Project

I have an existing VS2012 web application that has been running fine until I added in the latest AjaxControlToolkit (7.0123). Initially, I found that the installation broke the behaviour of the UpdatePanel - whereas before I could refresh a page after an asynchronous post-back without repeating the operation I found that after installation the refresh would repeat the previous operation (I guess the post-back was no longer asynchronous).
I then noticed that, at some time in the past, I had commented out a number of the default JavaScript files that are added to a new ASP.NET Web Forms Application so I tried adding them back in. This resulted in an exception:
'MsAjaxBundle' is not a valid script name. The name must end in
'.js'.
I then tried replacing the default <asp:ScriptManager .../> with <ajaxControlToolkit:ToolkitScriptManager .../> this resulted in a new exception
Could not load file or assembly 'System.Web' or one of its
dependencies. The system cannot find the file specified.
For sanity, I then created a fresh ASP.NET Web Forms Application (VS2012, Update 2) and ran it. No errors. Using "nuget", I then added the AjaxControlToolkit v7.0123 (the latest release). Ran the application again and I get the original exception again:
'MsAjaxBundle' is not a valid script name. The name must end in
'.js'.
Once again, I replaced <asp:ScriptManager .../> with <ajaxControlToolkit:ToolkitScriptManager .../> and once again this results in
Could not load file or assembly 'System.Web' or one of its
dependencies. The system cannot find the file specified.
Can anybody shed any light on what else I need to do to resolve this? I can find no documentation to say anything needs to be changed manually when adding the toolkit.
Thanks,
Answer found at http://stephenwalther.com/archive/2012/09/20/september-2012-release-of-the-ajax-control-toolkit.aspx (always just after posting the question huh)
Replacing <asp:ScriptManager .../> with <ajaxControlToolkit:ToolkitScriptManager .../> is correct
Need to remove reference to MsAjaxBundle
Need to remove Assembly="System.Web" from script references
This fixes the exceptions (both in the new project and the original).
It does not however resolve the problem with the UpdatePanel no longer posting back asynchronously. I will raise this as a new question.
If you are using the April 2013 Release of the Ajax Control Toolkit see Stephen Walther's latest blog post:
http://stephenwalther.com/archive/2013/04/30/april-2013-release-of-the-ajax-control-toolkit.aspx
I was missing the new web.config settings that allow the AjaxFileUpload control to work in the new release
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="42949672" />
<httpHandlers>
<add verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
</handlers>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967295"/>
</requestFiltering>
</security>
</system.webServer>
</configuration>
When you see this "'MsAjaxBundle' is not a valid script name. The name must end in '.js'."
The Best thing you can do is:
Go to the site Master (Double click on it )
Search for "MsAjaxBundle" or " "
Comment this line eg. <%----%>
Save or compile your program and then run it
Thank God is working by now

SAP Crystal Reports Viewer does not display in browser

I own a ASP.NET web project with framework 4.5. Is installed and implemented an SAP report for VS2012 Crystal Reports Developer.
Making in Local report, it works correctly in browsers (Chrome, Firefox, IE) and the data in the correct exit. Now, at the time of publishing (on another server) the first thing we did was install the same version of SAP, so that there are the necessary libraries etc..
The problem I have is that the block of Report Viewer, I mean, what is the repot container, not shown in the browser, open the window where is this embedded but not shown anything in the Report Viewer, what the report will look even less.
Thinking it might be a data error or something, I tried to change the report and put a blank, where all that is shown is a text, and no connections or anything like that and removing the code that is not needed in the code behind, I just stopped loading the report.
In new local works, but on the web published, the Report Viewer still be
Anybody can help me a bit? I looking for some information about it but what I find in forums related, is that the report is not seen, but nothing of Report Viewer.
Thank you very so much in advance.
PS: I have checked the server log for error to any issue or Asp.Net Crystal Reports and not leave anything.
I have smiler problem and found a solution.
I think there is some problem in finding Resource from default Resource-Uri for formatting of crystal report.
For proper formatting
Copy C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13 this folder into your project.
And past these lines into your web.config file
<configSections>
<sectionGroup name="businessObjects">
<sectionGroup name="crystalReports">
<section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null" />
<section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
</sectionGroup>
</configSections>
<businessObjects>
<crystalReports>
<rptBuildProvider>
<add embedRptInResource="true" />
</rptBuildProvider>
<crystalReportViewer>
<add key="ResourceUri" value="/crystalreportviewers13" />
</crystalReportViewer>
</crystalReports>
</businessObjects>
Check this
This will help you.
Solved.... 100 % 'll work. Follow the below two steps:
1.Update Application Folder.
"C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13"
into your application root folder asp below snapshot.
Update Web.Config file by the following code.
After copying the folder "C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13" into your application root folder, be sure you copy and paste the give code:
<configSections>
<sectionGroup name="businessObjects">
<sectionGroup name="crystalReports">
<section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null" />
<section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
</sectionGroup>
</configSections>
<businessObjects>
<crystalReports>
<rptBuildProvider>
<add embedRptInResource="true" />
</rptBuildProvider>
<crystalReportViewer>
<add key="ResourceUri" value="/crystalreportviewers13" />
</crystalReportViewer>
</crystalReports>
</businessObjects>
Right after < configuration > tag in web.config file. for me any other place did not work and generated Error message.
For me, the webpage Developer Tools (F12 then Console tab) showed that the server was looking for root/aspnet_client/system_web/4_6_1069 folder when I had copied the files into the 4_0_30319 folder. I renamed the folder and BAM!
I believe you need to deploy it as .Net 4, not .Net 4.5.
For those of us running migrated projects from .Net 4.0 or lower to 4.5+ I have made an observation. It seems if your page that contains the viewer is in a subdirectory then the image urls are being generated relative to that page and not to the root of the web application. E.g if your page is /gl/accounts.aspx then the image may be /gl/crystalimagehandler.aspx etc A quick way to fix this is to change your handler mapping to a wildcard ending in crystalimagehandler.aspx or put the following code in Global.asax
protected void Application_BeginRequest(object sender, EventArgs e)
{
var p = Request.Path.ToLower().Trim();
if (p.EndsWith("/crystalimagehandler.aspx") && p!= "/crystalimagehandler.aspx")
{
var fullPath=Request.Url.AbsoluteUri.ToLower();
var index = fullPath.IndexOf("/crystalimagehandler.aspx");
Response.Redirect(fullPath.Substring(index));
}
}
I had a situation where I had some Crystal Reports created using connection "SQL Server Native Client 11.0" and some using connection "Microsoft OLE DB Provider for SQL Server". Both worked on our old server running IIS 6. However, when we migrated over to a new server running IIS 8.5, some reports worked as expected, while others displayed an empty Crystal Reports viewer. After 4-5 days of pulling my hair out and trying everything I could think of, I finally compared everything between the reports that worked vs. the reports that did not work. What I discovered was the reports that worked used the "Microsoft OLE DB Provider for SQL Server" connection. Once I made this change, the reports served up perfectly.

How to consume SL/RIA as WCF

Using VS2012 and beginning with a SL Business Application project, I added
an EF model Model1, removed the tt files, changed code gen to Default and built the project. Then I added DomainService1 with various tables. OData was not selected.
Starting the app it appears there is a service available:
But if we click the url, we expect to see XML, and it doesn't work. Appending ?wsdl should cause XML to be sent to the browser, but I just get the illustrated page. Trying it with svcutil as suggested by this page produces this:
Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication
Foundation, Version 4.0.30319.17929] Copyright (c) Microsoft Corporation.
All rights reserved.
Attempting to download metadata from 'http://localhost:57880/Ria1-Web-DomainService1.sv
c?wsdl' using WS-Metadata Exchange or DISCO. Generating files...
Warning: No code was generated. If you were trying to generate a client, this could be
because the metadata documents did not contain any valid contracts or services or
because all contracts/services were discovered to exist in /reference assemblies.
Verify that you passed all the metadata documents to the tool.
Warning: If you would like to generate data contracts from schemas make sure to use
the /dataContractOnly option.
This appears to suggest the MEX endpoint isn't properly designed, so out came my WCF books, but there is no correlation between what they think ought to be in <system.serviceModel> and what actually was there:
<system.serviceModel>
<serviceHostingEnvironment
aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
What do I need to add to the config to expose the metadata?
While preparing this question it occurred to me to wonder what happens to the config when you do specify OData. This turned out to be the right question. You get this:
<system.serviceModel>
<serviceHostingEnvironment
aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<domainServices>
<endpoints>
<add name="OData"
type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory,
System.ServiceModel.DomainServices.Hosting.OData,
Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
</endpoints>
</domainServices>
</system.serviceModel>
This gave me a few more search terms. Combining information from various sources led to this:
<add name="Soap"
type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory,
Microsoft.ServiceModel.DomainServices.Hosting,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
which totally failed to work until I added a reference to this:
Whereupon everything lit up and there was much rejoicing.

ASP.NET ReportViewer works in development, is empty when deployed

I have a ASP.NET web app that utilizes ReportViewer to show local reports. Everything works beautifully on my development machine (XP Pro, Visual Studio 2008). When I deploy the app to the production server (Windows Server 2008, IIS 7), the site works very well, except for the report viewer. When I generate the report, the report viewer remains empty.
I have written debugging code to verify that the records are being received from the database, and they are. No error occurs but, no records are show in the report viewer. Also, the images that normally appear in the menu bar of the ReportViewer control (export button, print button, forward and back buttons, etc) do not load either.
I ran the ReportViewer.exe on the server to install the appropriate files, and I have verified that they are in the GAC of the machine.
Can anyone suggest a way to debug this...it would be easier if an error was being generated (I can't believe I just said that)?
Please verify that you have the required web.config entries. My suspicion is that you are missing the entry in system.webServer/handlers, which is required in IIS7. IIS7 pretty much ignores the system.web/httpHandlers section, which may explain why it works in IIS 5.1 (XP) but not in 7.
Version numbers may vary, but this should cover it for entries:
In the system.web/compilation section:
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
In the system.web/httpHandlers section
<add path="Reserved.ReportViewerWebControl.axd"
verb="*"
type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
validate="false" />
And in the system.webServer/handlers section:
<add name="ReportViewer"
path="Reserved.ReportViewerWebControl.axd"
verb="*"
type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
preCondition="integratedMode" />

ReplacableToken_ when using web.config transform?

I have a web.config with 2 transforms - for debug and release.
web.config:
<connectionStrings>
<clear />
<add name="StrName" connectionString="data source=.\sqlexpress;User Id=sa;Password=pass;Database=SocialBot;"
providerName="System.Data.SqlClient" />
</connectionStrings>
I just copied the example given and replaced the name with StrName. I end up with :
<add name="StrName" connectionString="$(ReplacableToken_SocialBotConnectionString-Web.config Connection String_0)"
providerName="System.Data.SqlClient" />
What the hell is ReplacableToken_ ?
I have another project and it works with no problem there.
If, like me, you're running up against this problem while trying to automate your build process using msbuild from the command line. Specifically, the parameter you need to set is:
/p:AutoParameterizationWebConfigConnectionStrings=False
This is most likely what VS is doing on your behalf when you publish to the filesystem
If you want to build with Visual Studio 2010, add the following line to your configuration PropertyGroup in your .csproj:
<AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings>
More details here:
How to get rid of "$(ReplacableToken...)" in web.config completely