cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal report works on localhost, but it doesn´t work after publish in IIS

0 Kudos

Hi SAP workers, is a pleasure to join at this community.

This is my first question and I want to explain the situation.

I use Crystal reports (version CRforVS_13_0_21) in Visual Studio 2017 in 64 bits.

Then, I have a report that functions very well in my PC, but when I try to export to PDF in the publish web site (in IIS) throws me the next error:

No se pudo abrir la conexión.
temp_49a4fd90-5fe3-475d-96e0-4adadcc07890 1196_1208_{0CF02AEA-0B01-446A-BF6A-34EAC10FB35B}.rpt

I don´t understand why is show me that line.

My connection is ODBC (RDO) type (I use a dataset to load the report).

The code for load the report is:

//First use this instruction to load the report and save in a session variable.

PDFOC rpt1 = new PDFOC();

if (txtNOC.Text.Length > 0)

{

string repaxu = txtNOC.Text;

repaxu = repaxu.Replace("OC", "");

rpt1.SetParameterValue("id Compra", Int32.Parse(repaxu));

}

else

{

rpt1.SetParameterValue("id Compra", Int32.Parse("0"));

}

crvoc.ReportSource = rpt1;

Session["reporte"] = rpt1;

//Next, after button click, I load the session and export to pdf


PDFOC rpt1 = (PDFOC)Session["reporte"];

rpt1.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "Orden de Compra");

Please help me, I don´t understand where is the error.

Thank you so much, have a nice weekend.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Sounds like the app can't find the 64 bit database driver your report uses.

0 Kudos

Thank you so much, I finally discover the error:

The problem was the connection, I was using an odbc conection, but when I write a direct connection string, the report works very good.

Thank you so much.

Answers (4)

Answers (4)

0 Kudos

So it works with saved data but you can't connect when refreshing so it's likely a DB client problem.

Your app depends on the runtime and client it needs, so if IIS is running in 64 bit mode you need to 64 bit Client installed.

0 Kudos

Thank you for help me. I continue with the problem. But now, I discover other detail:

The datasource and the DataTable are working good. Therefore, I search more and I saw a detail:

When I initialize the instance of mi report and I want to set the datasource, always is nul, never changes even though I verify the dataset is loading information for the database.

Then...can you guide me about what error may be?

Thank you so much.

0 Kudos

If you just preview the report and use the Viewers Export feature does that work?

Use Fiddler to see what it says, likely need to add a share on the viewer folder with full read/write and add permissions to the \Temp folder as well.

Is IIS running in 32 or 64 bit mode?

Did you install the same MSI package?

0 Kudos

I finally get the error. When I do the report and I pass the parameter in the file, the export only functions with the same value typed in the visual studio (in the localhost and the publish works), but when I put a diferent value at the parameter in the .rpt, then the connection fails and the error appears.

The conecction to DataBase is for a remot server (i dont have installed the mysql, because I connect to a server) but the connector is already installed.

I think the IIS run in 64 bits. After searching, I can find why the report have that behavior.

0 Kudos

Remove the code to set parameter value, it should prompt for log on info and the parameter prompt should pop up.

0 Kudos

I remove the parameter value and the parameter prompt don´t pop up.

Could be that I need permission to conect at the DataBase? The report in my PC works good, only after publish in IIS I have problems.

Thank you so much!

0 Kudos

Looks like you are setting the parameter before opening the report.

Try opening the report and then setting the parameter values.

0 Kudos

I did that and the error is the same, not change.