Crystal Reports exception in Visual Studio 2013

2019-04-17 08:21发布

问题:

rptdoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "DO- " + DateTime.Now.ToString("dd-MM-yyyy HHmmss"));

Above line of code is throwing this exception:

An exception of type 'System.MissingMethodException' occurred in CrystalDecisions.CrystalReports.Engine.dll but was not handled in user code

Additional information: Method not found: 'CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag CrystalDecisions.ReportAppServer.ReportDefModel.ISCRExportOptions.get_ExportOptionsEx()'

I am using Visual Studio 2013 and Crystal Reports 13

回答1:

Once I faced the same issue on my production server. until the day before everything was working good, but the next day, the error was showing up.

After long hours struggling with issue i remembered for some testing reasons, i had changed the "Application Pool Settings -> Enable 32-Bit Applications" to True, while my server is 64bit; i changed it back to false and everything got normal.

If your server is 32 make this option True, otherwise make it false.



回答2:

try to add this in your code:

VB.Net

 Imports CrystalDecisions.Shared
 Imports CrystalDecisions.CrystalReports.Engine

C#

using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;

and Add a reference to your project for the required dll, or you can install crystal report viewer to your machine



回答3:

if your windows is x64 make sure you make your application target x64 or any CPU not X86 and the same if you use windows 32 bit make sure that you set project to target x86