我写了一个Web程序,在Web中使用水晶报表导出Pdf文件,进行格式化打印报表文件.可是我在往服务器上移植的时候,出现以下错误!
*******************************************错误*************************************
无法找到密钥号码 dll 或密钥号码无效。 
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: CrystalDecisions.CrystalReports.Engine.InternalException: 无法找到密钥号码 dll 或密钥号码无效。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: 
[InternalException: 无法找到密钥号码 dll 或密钥号码无效。]
   .F(String  , EngineExceptionErrorID 
) +642
   .B(String , Int32 ) +57
   CrystalDecisions.CrystalReports.Engine.ReportDocument.;() +192
   CrystalDecisions.CrystalReports.Engine.ReportDocument.InternalInit() +138
   CrystalDecisions.CrystalReports.Engine.ReportDocument..ctor() +63
   CrystalDecisions.CrystalReports.Engine.ReportClass..ctor() +65
   NXCIMC.WebOA.User.Rpt.rptSendDocBill..ctor()
   NXCIMC.WebOA.User.PdfPrint.GetPrintFile(String recordId, String docType)
   NXCIMC.WebOA.User.PdfPrint.Page_Load(Object sender, EventArgs e)
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +731
*****************************************************************************
有朋友能够帮助指导以下吗?谢谢
 

解决方案 »

  1.   

    你引用的dll文件有没有一起移到服务器相应路径?  一般如果你不想在服务器端安装控件的话,你要把用到的控件dll放到站点下的bin文件夹下引用。
      

  2.   

    我把Managed文件夹内的所有文件都拷到bin目录下还是出现错误。
    错误如下:
    ********************************************************
    Error in File C:\DOCUME~1\SERVER2\ASPNET\LOCALS~1\Temp\temp_ce30210a-1457-4d59-96f5-3c4cef47c4d8.rpt: Invalid export DLL or export format. 
    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: CrystalDecisions.CrystalReports.Engine.InvalidArgumentException: Error in File C:\DOCUME~1\SERVER2\ASPNET\LOCALS~1\Temp\temp_ce30210a-1457-4d59-96f5-3c4cef47c4d8.rpt: Invalid export DLL or export format.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: 
    [InvalidArgumentException: Error in File C:\DOCUME~1\SERVER2\ASPNET\LOCALS~1\Temp\temp_ce30210a-1457-4d59-96f5-3c4cef47c4d8.rpt:
    Invalid export DLL or export format.]
       .F(String  , EngineExceptionErrorID 
    ) +406
       .A(Int16 , Int32 ) +530
       CrystalDecisions.CrystalReports.Engine.FormatEngine.internalSetExportOptions(ExportOptions exportOptions) +3400
       CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) +445
       CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType) +141
       NXCIMC.WebOA.User.PdfPrint.GetPrintFile(String recordId, String docType) in E:\Inetpub\wwwroot\WebUI\PdfPrint.aspx.cs:134
       NXCIMC.WebOA.User.PdfPrint.Page_Load(Object sender, EventArgs e) in E:\Inetpub\wwwroot\WebUI\PdfPrint.aspx.cs:36
       System.Web.UI.Control.OnLoad(EventArgs e) +67
       System.Web.UI.Control.LoadRecursive() +35
       System.Web.UI.Page.ProcessRequestMain() +731 *******************************************************************
      

  3.   

    你考到bin下面后 引用也要从bin下面引用
      

  4.   

    感谢大家的支持,问题已经解决,虽然有些问题任然还是有点糊涂。不过总归是能用了
    把这个问题总结一下:
      我在项目中使用水晶报表,将报表直接导出pdf文件进行打印和保存,在开始我直接把托管的水晶报表文件拷贝到bin目录下,程序开始报ReportDocument没有注册的错误;我根据看到的一些文章,对Web工程进行打包安装,将水晶报表也打了包,程序还是无法正确运行;这回开始报Export.dll错误和导出类型错误,我检查了打包文件发现少了crxf_pdf.dll文件,我觉得可能是这个没有打包进去,我就直接把它拷贝到服务器水晶报表文件的安装目录里,刚开始还是无法运行,不久不知道怎么就可以用了。感觉非常的莫名其妙,不过总归问题解决了。
    不过目前我还是不知道为什么合并文件没有将crxf_pdf.dll打包进去,在打包文件里有crxf_xls.dll\word\rtf为什么没有pdf.
    有哪个朋友对这个方面很了解,能够给我讲讲。谢谢
    [email protected]