views:

852

answers:

3

I upgraded my ASP.Net app from .net 1.1 to .net 2.0. All of the webpages work fine but the crystal reports won't load.

Stack trace:

Load report failed.
StackTrace:    at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
   at CrystalDecisions.CrystalReports.Engine.ReportClass.Load(String reportName, OpenReportMethod openMethod, Int16 parentJob)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.EnsureLoadReport()
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet)

Does anyone know why it won't load?

Architecture: Windows Server 2008 IIS 7

Code to call report:

ReportClass ApprovalPage=new CustomerJobLabelApprovalMod();
ApprovalPage.SetDataSource(reportDataSet);

Code for CustomerJobLabelApprovalMod:

//------------------------------------------------------------------------------
// <autogenerated>
//     This code was generated by a tool.
//     Runtime Version: 1.1.4322.2407
//
//     Changes to this file may cause incorrect behavior and will be lost if 
//     the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------

namespace LabelVault {
    using System;
    using System.ComponentModel;
    using CrystalDecisions.Shared;
    using CrystalDecisions.ReportSource;
    using CrystalDecisions.CrystalReports.Engine;


    public class CustomerJobLabelApprovalMod : ReportClass {

        public CustomerJobLabelApprovalMod() {

        }

        public override string ResourceName {
            get {
                return "CustomerJobLabelApprovalMod.rpt";
            }
            set {
                // Do nothing
            }
        }

        [Browsable(false)]
        [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public CrystalDecisions.CrystalReports.Engine.Section Section1 {
            get {
                return this.ReportDefinition.Sections[0];
            }
        }

        [Browsable(false)]
        [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public CrystalDecisions.CrystalReports.Engine.Section Section2 {
            get {
                return this.ReportDefinition.Sections[1];
            }
        }

        [Browsable(false)]
        [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public CrystalDecisions.CrystalReports.Engine.Section Section3 {
            get {
                return this.ReportDefinition.Sections[2];
            }
        }

        [Browsable(false)]
        [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public CrystalDecisions.CrystalReports.Engine.Section Section4 {
            get {
                return this.ReportDefinition.Sections[3];
            }
        }

        [Browsable(false)]
        [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public CrystalDecisions.CrystalReports.Engine.Section Section5 {
            get {
                return this.ReportDefinition.Sections[4];
            }
        }
    }

    [System.Drawing.ToolboxBitmapAttribute(typeof(CrystalDecisions.Shared.ExportOptions), "report.bmp")]
    public class CachedCustomerJobLabelApprovalMod : Component, ICachedReport {

        public CachedCustomerJobLabelApprovalMod() {
        }

        public virtual bool IsCacheable {
            get {
                return true;
            }
            set {
                // 
            }
        }

        public virtual bool ShareDBLogonInfo {
            get {
                return false;
            }
            set {
                // 
            }
        }

        public virtual System.TimeSpan CacheTimeOut {
            get {
                return CachedReportConstants.DEFAULT_TIMEOUT;
            }
            set {
                // 
            }
        }

        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
            CustomerJobLabelApprovalMod rpt = new CustomerJobLabelApprovalMod();
            rpt.Site = this.Site;
            return rpt;
        }

        public virtual string GetCustomizedCacheKey(RequestContext request) {
            String key = null;
            // // The following is the code used to generate the default
            // // cache key for caching report jobs in the ASP.NET Cache.
            // // Feel free to modify this code to suit your needs.
            // // Returning key == null causes the default cache key to
            // // be generated.
            // 
            // key = RequestContext.BuildCompleteCacheKey(
            //     request,
            //     null,       // sReportFilename
            //     this.GetType(),
            //     this.ShareDBLogonInfo );
            return key;
        }
    }
}
+1  A: 

I seem to remember doing this a while back and I found some references to the old Crystal Reports stuff in the web.config.

ajh1138
+1  A: 

A whole lot of hard googling later...

I had to grant NETWORK SERVICE permissions on Windows\Temp because Cyrstal Reports uses that user, and not the user that is impersonated (with Admin rights), and that directory, not the IIS directories, is the one that it uses.

That was a little frustrating, but it works now!

Thanks folks.

A: 

Yes granting permissions to NetworkService user solved my problem of getting "Load Report Failed" error. Thanks Guys.

Nidhi