0
votes

I'm attempting to generate a PDF from a crystal reports .rpt file, and the call to .Open() fails with the message "Failed to connect to server %MACHINENAME%. Crystal Reports isn't my forte and is somewhat peripheral to our application's main function (ASP.NET Intranet app), so please tell me if I'm way off the path here.

I'm using the ReportClientDocument class out of the ReportAppServer namespace, here's the part of the code where I'm attempting to open the report

        m_boRptFile = @"\\path\to\report\179c7144d118b715b.rpt";
        try
        {
            var path = (object)m_boRptFile;
            if (impersonateValidUser("username", "domain", "password"))
            {
                if (File.Exists(m_boRptFile))
                {
                    FileInfo f = new FileInfo(m_boRptFile);
                    FileStream fs = f.OpenRead();
                    if (fs.CanRead)
                        m_boReportClientDocument.Open(ref path, (int)CdReportClientDocumentOpenOptionsEnum.cdReportClientDocumentOpenAsReadOnly);
                }
                undoImpersonation();
            }
        }

The report file is on a remote (BOEXI) server, but copying the .rpt file to my machine doesn't help either.

The full text of the Exception I get is:

Failed to connect to server "%MACHINENAME%". Error returned from Windows Sockets API getaddrinfo: 11001.

1
Winsock error 11001 is WSAHOST_NOT_FOUND, so the server specified in the report (probably for the database connection) can't be located.Ken White
Did you ever figure this out?Michael T

1 Answers

0
votes

Open the report in crystal and see if you get an error when you runt the report. If the report does not then you will have to reconnect to the database.