发布的报告不起作用 - 数据库登录失败错误 [英] published reports don't work - Database logon failed Error

查看:171
本文介绍了发布的报告不起作用 - 数据库登录失败错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个简单的Web应用程序,它在VS 2013上创建了3个报告,由于某些原因,这些报告从开发人员模式运行良好,但是当我发布网站时,他们给我数据库登录失败错误。可能是什么导致了这个? VS安装在我发布报告的同一台服务器上。我创建了一个本地管理员用户,其信息与用于IIS身份验证的ODBC连接登录用户完全相同,但仍然没有运气。

I am developing a simple web app that has 3 reports created on VS 2013, for some reason those reports run fine from developer mode, but when I publish the website they give me "Database logon failed" Error. What could be causing this? VS is installed on the same server that I am publishing the reports. I have created a local admin user with exactly the same info as the ODBC connection logon user for IIS authentication, but still no luck.

下面是我的代码:

public partial class OpenWOsWebForm : System.Web.UI.Page
    {
        ConnectionInfo EPAKconnectionInfo = new ConnectionInfo();

        protected void SetConnectionInfo()
        {

            EPAKconnectionInfo.ServerName = ConfigurationManager.AppSettings["EPAK_SERVER_NAME"];
            EPAKconnectionInfo.UserID = ConfigurationManager.AppSettings["EPAK_USER_NAME"];
            EPAKconnectionInfo.Password = ConfigurationManager.AppSettings["EPAK_PASSWORD"];
        }

        private void Page_Init(object sender, EventArgs e)
        {

            ReportDocument report = new ReportDocument();
            report.Load("C:\\Delray Beach\\Delray Beach\\Reports\\OpenWOsReport.rpt");
            SetConnectionInfo();
            TableLogOnInfo crTableLogoninfo = new TableLogOnInfo();

            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in report.Database.Tables)
            {
                crTableLogoninfo = CrTable.LogOnInfo;
                crTableLogoninfo.ConnectionInfo = EPAKconnectionInfo;
                CrTable.ApplyLogOnInfo(crTableLogoninfo);
            }
            foreach (ReportDocument subreport in report.Subreports)
            {
                foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in subreport.Database.Tables)
                {
                    crTableLogoninfo = CrTable.LogOnInfo;
                    crTableLogoninfo.ConnectionInfo = EPAKconnectionInfo;
                    CrTable.ApplyLogOnInfo(crTableLogoninfo);
                }
            }

            OpenWOsViewer.ReportSource = report;

            OpenWOsViewer.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
        }
    }

谢谢

推荐答案

在我的情况下,问题出现在 IIS应用程序池/我的网络应用程序/高级设置 32位应用程序被禁用,我没有在我的项目中包含文件夹 aspnet_client 其中 crystal run-时间文件是存储,所以我发布应用程序的时间,这些文件没有转移。一旦我启用了连接并包含该文件夹,问题就解决了。

In my case the problem was that on IIS Application Pools/ my web app/ Advanced Settings the 32 bit Applications was disable and I wasn't including on my project the folder aspnet_client where crystal run-times files are storage, so the time I was publishing the app, those files wren't transferred. Once I enabled the connection and included that folder the issue got resolved.

这篇关于发布的报告不起作用 - 数据库登录失败错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆