我正在使用带有ADO Connection(集成安全性)的Visual Studio 2015的Crystal报表到SQL Server 2014.即使报表在调试模式下工作,当我发布站点时,我收到以下错误:

详细信息:[数据库供应商代码:18456]无法打开连接 . 详细信息:[数据库供应商代码:4060]无法打开连接 .

这是我打开报告的代码:

protected void btnPrint_Click(object sender, EventArgs e)
    {
        HttpContext.Current.Session["ID"] = lblID.Text;
        Response.Write("<script>");
        Response.Write("window.open('PrintPage.aspx' ,'_blank')");
        Response.Write("</script>");

        ReportDocument cryRpt = new ReportDocument();
        Random random = new Random();
        int randomNumber = random.Next(0, 100000);

        try
        {
            if (String.IsNullOrEmpty(lblID.Text))
                Response.Redirect("Page1.aspx");
            else
            {
                cryRpt.Load(Server.MapPath("~/Reports/repPage1.rpt"));

                if (!String.IsNullOrEmpty(lblID.Text))
                {
                    cryRpt.SetParameterValue("@ID", lblID.Text);

                    ExportOptions CrExportOptions;
                    DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
                    PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
                    CrDiskFileDestinationOptions.DiskFileName = "C:\\temp\\Report" + lblID.Text + randomNumber + ".pdf";
                    CrExportOptions = cryRpt.ExportOptions;
                    {
                        CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                        CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
                        CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
                        CrExportOptions.FormatOptions = CrFormatTypeOptions;
                    }
                    cryRpt.Export();

                    string FilePath = "C:\\temp\\Report" + lblID.Text + randomNumber + ".pdf";
                    WebClient User = new WebClient();
                    Byte[] FileBuffer = User.DownloadData(FilePath);
                    if (FileBuffer != null)
                    {
                        Response.ContentType = "application/pdf";
                        Response.AddHeader("content-length", FileBuffer.Length.ToString());
                        Response.BinaryWrite(FileBuffer);
                    }
                }
            }
        }
        catch (Exception ex)
        { appObj.myMessageBox(ex.Message); }

        finally
        {
            File.Delete("C:\\temp\\Report" + lblID.Text + randomNumber + ".pdf");
        }
    }

请注意,在同一IIS上运行其他站点并且具有相同代码的报告正在运行(VS2015,SQL Server 2014,集成安全性) .

任何形式的帮助将不胜感激 .