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.
11001
isWSAHOST_NOT_FOUND
, so the server specified in the report (probably for the database connection) can't be located. – Ken White