cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Version Mismatch on Deployment

Former Member
0 Likes
1,306

Hi,

I think I have a version mismatch problem here on deployment, but cannot figure out how to resolve it. We have two ASP.NET web apps deployed, called App1 and App2. Both use Crystal Reports. The reports display fine in a report viewer on App1 but on App2 all I get is a blank viewer.

App1 was originally developed in Visual Studio 2008 along with CR2008, incorporating CrystalDecisions.Web ver. 12.0.2000. Then it was deployed to the server, along with appropriate redistributable. It all worked fine.

App2 came along, and I switched to VS2010 and CR2010. I also converted App1 to build and run on my dev machine in VS2010 and CR2010, using CrystalDecisions.Web ver. 13.0.2000. On my dev machine, both apps run fine and report fine.

I deployed App2 to the server, along with the appropriate redistributable for CR. I did not deploy the updated App1. So now on the server, App1 is looking for ver. 12.0.2000.0 of CrystalDecisions.Web in the GAC, and App2 is looking for ver. 13.0.2000.0.

I have verified that both versions of CrystalDecisions.Web are in the GAC.

Now App1 still reports fine on the server (although there were some non-reproducible hiccups), but App2 will not display the report. The viewer comes up blank. Again, this works on my dev machine.

Any suggestions as to why App2 will not view the reports? The relevant code from the App2 web.config is listed below. The source code from the page that actually displays the report is in a followup reply, since it seems too large to put in this message.

Thanks.

--Dan

web.config


<?xml version="1.0"?>
<configuration>
  <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"/>
      </sectionGroup>
    </sectionGroup>
  </configSections>
  
	<appSettings>
	  <add key="CrystalImageCleaner-Age" value="120000"/>
	  <add key="CrystalImageCleaner-AutoStart" value="true"/>
	  <add key="CrystalImageCleaner-Sleep" value="60000"/>
 
	  <!--	DB credentials for CrystalReports -->
		<add key="ReportDatabaseName" value="MyDB"/>
		<add key="ReportPassword" value="myPassword?"/>
		<add key="ReportServerName" value="MyServer"/>
		<add key="ReportUserID" value="MyUser"/>
	</appSettings>
 
	<system.web>
      <compilation debug="true" targetFramework="4.0">
         <assemblies>
           <add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
           <add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
           <add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
           <add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
           <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
         </assemblies>
         <buildProviders>
            <add extension=".rpt" type="CrystalDecisions.Web.Compilation.RptBuildProvider, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
         </buildProviders>
      </compilation>
     
	  <httpHandlers>
		<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
		<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
	  </httpHandlers>
		
	  <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
	</system.web>
 
	<system.webServer>
	  <handlers>
		<add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/>
		<add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/>
	  </handlers>
 
	</system.webServer>
 
   <businessObjects>
      <crystalReports>
         <rptBuildProvider>
            <add embedRptInResource="true"/>
         </rptBuildProvider>
      </crystalReports>
   </businessObjects>
</configuration>



View Entire Topic
Former Member
0 Likes

Here is the rest of the source code, both declarative and code-behind.

ReportPage.aspx


<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeFile="ReportPage.aspx.cs"
	Inherits="Reports_ReportPage" %>

<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
	Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head2" runat="server">
	<title></title>
</head>
<body>
	<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager2" runat="server"></asp:ScriptManager>
	
	<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" 
      AutoDataBind="True"
		GroupTreeImagesFolderUrl="" 
		Height="1158px" 
		ToolbarImagesFolderUrl=""
		ToolPanelWidth="200px" 
		Width="1059px" />

	</form>
</body>
</html>

ReportPage.aspx.cs


using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System;
using System.Configuration;
using System.Data;
using System.Text;							

public partial class Reports_ReportPage : Page
{
	ReportDocument rptDoc;

	protected void Page_Load(object sender, EventArgs e)
	{
		#region QueryStrings
		long lngKeyFieldID = -1;
		string strReportName = string.Empty;
		string strReportType = string.Empty;
		
		if (Request.QueryString["strReportName"] != null)
			strReportName = Request.QueryString["strReportName"].ToString();

		if (Request.QueryString["strReportType"] != null)
			strReportType = Request.QueryString["strReportType"].ToString();

		if (Request.QueryString["KFID"] != null)
		{
			lngKeyFieldID = Convert.ToInt64(Request.QueryString["KFID"]);
		}
		#endregion		//  QueryStrings

		rptDoc = new ReportDocument();

		string strReportSourceFolder = ConfigurationManager.AppSettings["ReportSourceFolder"];
		rptDoc.Load(strReportSourceFolder + strReportName + ".rpt");

      #region parameters
      if (lngKeyFieldID > 0)
		{
         //  set parameters based on rpt name
			switch (strReportName)
			{
				case "JobDetails":
					rptDoc.SetParameterValue("JobID", lngKeyFieldID);
					rptDoc.SetParameterValue("IsPaid", true);
					break;
			}		
		}
		#endregion		//  parameters
 
		#region DB connection
		//  from Deepu at SAP tech support
		//  this is necessary to pass db credentials programmatically
		//  the report must be designed in CR using an OLE DB connection type
		ConnectionInfo conn = new ConnectionInfo();
		conn.ServerName = ConfigurationManager.AppSettings["ReportServerName"];
		conn.DatabaseName = ConfigurationManager.AppSettings["ReportDatabaseName"];

		if (conn.ServerName == "Dev")
			conn.IntegratedSecurity = true;
		else
		{
			conn.UserID = ConfigurationManager.AppSettings["ReportUserID"];
			conn.Password = ConfigurationManager.AppSettings["ReportPassword"];
		}

		Tables tables = rptDoc.Database.Tables;
		foreach (Table table in tables)
		{
			TableLogOnInfo tableLogonInfo = table.LogOnInfo;
			tableLogonInfo.ConnectionInfo = conn;
			table.ApplyLogOnInfo(tableLogonInfo);
		}	
		#endregion		//  DB connection

		#region Viewer
		CrystalReportViewer1.DisplayGroupTree = false;		//  deprecated, but still works
		CrystalReportViewer1.DisplayToolbar = true;
		CrystalReportViewer1.HasToggleGroupTreeButton = false;
		CrystalReportViewer1.HasToggleParameterPanelButton = false;

		CrystalReportViewer1.Page.Title = strReportName;

		CrystalReportViewer1.ReportSource = rptDoc;
		#endregion		//  Viewer
	}		

	protected void Page_Unload(object sender, EventArgs e)
	{
		if (rptDoc != null)
		{
			rptDoc.Close();
			rptDoc.Dispose();
		}
	}
	
}