1
votes

I have used crystal report with VS2010 with IIS 7. I can connect the DB from WEB application. However, it throws "Logon Failed", if the application run with IIS 7.

I tried with following VB.NET code

Dim boConnectionInfo As New ConnectionInfo()

boConnectionInfo.ServerName = ConfigurationManager.AppSettings("CRServerName").ToString

boConnectionInfo.DatabaseName = ConfigurationManager.AppSettings("CRDatabaseName").ToString

boConnectionInfo.UserID = ConfigurationManager.AppSettings("CRUserID").ToString

boConnectionInfo.Password = ConfigurationManager.AppSettings("CRPassword").ToString


boReportDocument.VerifyDatabase()

boReportDocument.Refresh()

it throws following exceptions

Log on failed. at CrystalDecisions.CrystalReports.Engine.ReportDocument.VerifyDatabase() at IPSReport.btnViewPort_Click(Object sender, EventArgs e) in C:\inetpub\wwwroot\IPS_CrysRpt_VS2010\Report.aspx.vb:line 383 at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Could you please help me out to find the cause of error and solutions for it?

Thanks VG

1

1 Answers

0
votes

You haven't ascertained whether the values being read from the Web.Config file via the AppSettings static class are the values you expect them to be.

If by saying "I can connect the DB from WEB application." you mean "I can connect to the database inside Visual Studio but my application won't connect when deployed and running under IIS" then the answer is that the connection settings being read by the application when you deploy it under IIS are not the same as the credentials you are using when you connect in Visual Studio. Typically this is because you haven't deployed the Web.Config containing the credentials correctly.

To determine whether this is true; (1) look at the contents of the Web.Config you have deployed on IIS, (2) output the credentials you are reading during your connection attempt using some logging framework (or just write them as the HTML output). You will probably find they are not the credentials you think they are.