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.
below is my code:
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;
}
}
Thanks
Besides "Database logon failed", does it say "Unable to connect: incorrect log on parameters"?
If so, try this: https://stackoverflow.com/a/24578304/2248943
And try these:
I faced this problem many times and each case was solved by one of these actions.
In my case the problem was that on
IIS Application Pools/ my web app/ Advanced Settings
the32 bit Applications
was disable and I wasn't including on my project the folderaspnet_client
wherecrystal 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.