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

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

问题描述

我正在开发一个简单的 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 应用程序池/我的 web 应用程序/高级设置 32 位应用程序 被禁用,我没有在我的项目中包含 aspnet_client 文件夹,其中 水晶运行时文件 是存储的,所以当我发布应用程序时,那些文件没有传输.一旦我启用连接并包含该文件夹,问题就解决了.

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天全站免登陆