Skip to Content

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

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.

error-cr-vs.png (88.0 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • Best Answer
    Feb 20 at 03:36 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 11 at 05:19 PM

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

    Try opening the report and then setting the parameter values.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 13 at 03:13 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 13 at 08:49 PM

    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?

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • Feb 14 at 05:26 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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.