cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Report Works with IIS Epress but not with Local IIS

Former Member
0 Kudos

Hi,

I have an ASP.Net MVC solution (Visual Studio 2015 - C#) and I am trying to export a crystal report to pdf.

If I apply IIS Express to my project, then I can export successfully the report to pdf .

But when I change it to Local IIS and run the same code

reportDocument.ExportToStream(ExportFormatType.PortableDocFormat)

I get the error below :

System.Runtime.InteropServices.COMException: The system cannot find the path specified.

I googled it and found that it may be an authentication error, so I added the "IIS AppPool\DefaultAppPool" user to the security section of the folder that contains the Crystal Report files. But the problem remains..

Do you have any workaround about this?

Thanks in advance for your help!!!

Nicholas

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Typically its the \temp folder permissions IIS uses, make sure it has full read/write access.

Also needs full access to the viewer folder:

C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13

Fiddler trace may tell you more....

Don

Former Member
0 Kudos

Hi Don, thanks for the reply! I gave full access to those folders but I got the same error..As I mention bellow, I get this error when I try to export a reports that requires parameters. If I change the same report and delete the input params, then the export is done successfully!!!

Answers (1)

Answers (1)

Former Member
0 Kudos

An update is that I get this error when I try to export a report that requires input parameters (from C#). The reports that require no params are exported successfully!!

0 Kudos

Ah, that helps... Make sure you set the parameters first before exporting and before logging on..

What kind of parameters are they? Stored Procedure or CR Parameters?

Don

Former Member
0 Kudos

They are CR parameters. Another clue that I found is that if I go to the AppPool user Advanced Settings and change the "Enable 32-bit Applications" to true then I get no error. But this configuration creates other errors in my site so I want to avoid it!!!I use 32bit ODBC Hana Drivers, because in Crystal Reports Designer I cannot use 64 bit drivers (the CR 2011 Application is 32 bit).......

The code is

     ReportDocument cryRpt = new ReportDocument();

     TableLogOnInfo crTableLogOnInfo;

     cryRpt.Load(Server.MapPath("~/Content/Reports/Sol1.rpt"));

     cryRpt.SetParameterValue("DocKey@", 353);

     cryRpt.SetParameterValue("ObjectID@", 17);

            CrystalDecisions.Shared.ConnectionInfo crConnectioninfo = new CrystalDecisions.Shared.ConnectionInfo();

            crConnectioninfo.ServerName = @"xx.xx.xx.xx:30015";

            crConnectioninfo.UserID = "userid";

            crConnectioninfo.Password = "password";

            crConnectioninfo.DatabaseName = "dbname";

             foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in cryRpt.Database.Tables)

            {

                crTableLogOnInfo = crTable.LogOnInfo;

                crTableLogOnInfo.ConnectionInfo = crConnectioninfo;

                crTable.ApplyLogOnInfo(crTableLogOnInfo);

            }

            foreach (ReportDocument subrep in cryRpt.Subreports)

            {

                foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in subrep.Database.Tables)

                {

                    crTableLogOnInfo = crTable.LogOnInfo;

                    crTableLogOnInfo.ConnectionInfo = crConnectioninfo;

                    crTable.ApplyLogOnInfo(crTableLogOnInfo);

                }

            }

     crTable.ExportToStream(ExportFormatType.PortableDocFormat)  <--Here I get the error message