I am developing a web app that has reports created on VS 2019 and run fine from developer mode, but when I publish the website I get "Database logon failed" Error. Database server is on different server that development and production machine.
The error is throwing in line
Note that I have the same version of crystal reports installed to developer and production machine and aspnet_client folder is on wwwroot.
Development machine: Windows 10, Visual Studio 2019, Crystal Reports v4.0.30319
Production machine: Windows Server 2012 R2, Crystal Reports v4.0.30319
What could be causing this? Thank you in advance.
This is my code:
public void sendEmail(int id)
ReportDocument cryRpt = new ReportDocument();
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = "server";
crConnectionInfo.DatabaseName = "db";
crConnectionInfo.UserID = "username";
crConnectionInfo.Password = "pass";
CrTables = cryRpt.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
emailCreator(from, to, subject, body, "Attachment.pdf", cryRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat));
What I have tried:
1.I enabled 32-bit Application on Application Pool.
2.I changed Identity to Administrator (Application Pool --> Advance Settings) and back to ApplicationPoolIdentity, since it didn't work.
3.I try connecting from IIS Server to database server using the reports credentials to check if I have access and there is access.