none
Erro ao gerar um arquivo CrystalReports RRS feed

  • Pergunta

  • Pessoal estou gerando yum pdf atraves do crystal reports, e no desenvolvimento esta funcionando perfeitamente, quando publico na produção me retorna o seguinte erro:

    The system cannot find the file specified. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
    Exception Details: System.Runtime.InteropServices.COMException: The system cannot find the file specified.
    
    Source Error: 
    
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
    
    Stack Trace: 
    
    
    [COMException (0x80004005): The system cannot find the file specified.
    ]
       CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0
       CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) +159
       CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +489
    
    [CrystalReportsException: Load report failed.]
       CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +678
       CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) +1715
       CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename) +219
       IASD.CMS.Management.school.desk.reports.Default.Page_Load(Object sender, EventArgs e) in D:\TFS\IASD.CMS\Trunk\IASD.CMS\IASD.CMS.Management\school\desk\reports\Default.aspx.cs:30
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
       System.Web.UI.Control.OnLoad(EventArgs e) +132
       System.Web.UI.Control.LoadRecursive() +66
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
    
     
    
    
    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.5448; ASP.NET Version:2.0.50727.5456 


    Neste meu projeto em .aspx tenho outros relatóros em crystal reports rodando perfeitamente na produção.

    segue  a forma que estou gerando o rpt.

    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using CrystalDecisions.CrystalReports.Engine;
    using B = IASD.CMS.Business;
    using C = IASD.Core.Util;
    using System.IO;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Drawing.Imaging;
    using System.Collections.Generic;
    
    namespace IASD.CMS.Management.school.desk.report
    {
        public partial class Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                ReportDocument crReportDocument = new ReportDocument();
                
    
                dsDesk dsRelatorio = new dsDesk();
                string login = "";
                int SiteID = int.Parse(Request.QueryString["SiteID"].ToString());
    
                if (!string.IsNullOrEmpty(Request.QueryString["login"]))
                    login = Request.QueryString["login"].ToString();
    
                List<B.Student> p = new List<B.Student>();
    
                for (int i = 0; i < int.Parse(Request.QueryString["Contador"].ToString()); i += 2)
                {
                    B.Student objp = new B.Student();
                    
                    objp.UserName = Request.QueryString["login"].Split(',').GetValue(i).ToString();
                    objp.TipoSaida = Request.QueryString["login"].Split(',').GetValue(i + 1).ToString();
    
                    p.Add(objp);
                }
    
                dsRelatorio.dtDesk.Merge(B.Student.ListUserStudantDesk(p, SiteID, Request.QueryString["GroupID"].ToString(), 
                                                                                  Request.QueryString["cod_serie"].ToString(), 
                                                                                  Request.QueryString["cod_turma"].ToString()));  
                   
                crReportDocument.Load(Server.MapPath("crDesk.rpt"));
    
                crReportDocument.SetDataSource(dsRelatorio);
    
                            
                //Utilizando Viewer
                //crPrintPreview.ReportSource = crReportDocument;
    
                //Utilizando exportação para pdf
                BinaryReader stream = new BinaryReader(crReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat));
    
                //LerFotos();
    
                HttpContext.Current.Response.ClearContent();
                HttpContext.Current.Response.ClearHeaders();
                HttpContext.Current.Response.ContentType = "application/pdf";
                HttpContext.Current.Response.BinaryWrite(stream.ReadBytes(Convert.ToInt32(stream.BaseStream.Length)));
                HttpContext.Current.Response.Flush();
                HttpContext.Current.Response.Close();
            }       
        }
    }
    

    Não sie o que fazer se alguém tem uma idéia por favor me diga.

    Att.


    Moizés Cerqueira | MCP
    Site: www.moizes.cerqueira.nom.br
    Twitter: @moicer

    quinta-feira, 12 de abril de 2012 17:40

Respostas

Todas as Respostas