我在IIS 7中使用了VS2010的水晶报告。我可以从WEB应用程序连接数据库。但是,如果应用程序与IIS 7一起运行,则会抛出“Logon Failed”。
我尝试使用以下VB.NET代码
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()
它抛出以下异常
登录失败。 在 CrystalDecisions.CrystalReports.Engine.ReportDocument.VerifyDatabase() 在IPSReport.btnViewPort_Click(Object sender,EventArgs e)中 C:\ inetpub \ wwwroot \ IPS_CrysRpt_VS2010 \ Report.aspx.vb:第383行 System.Web.UI.WebControls.Button.OnClick(EventArgs e)at System.Web.UI.WebControls.Button.RaisePostBackEvent(字符串 eventArgument)at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(字符串 eventArgument)at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,String eventArgument)at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
在System.Web.UI.Page.ProcessRequestMain(布尔值 includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)
你能帮我找出错误的原因和解决方案吗?
由于 VG
答案 0 :(得分:0)
您还没有确定通过AppSettings静态类从Web.Config文件中读取的值是否是您期望的值。
如果说"我可以从WEB应用程序连接数据库。"你的意思是"我可以连接到Visual Studio内的数据库,但我的应用程序在IIS"下部署并运行时不会连接。那么答案是,在IIS下部署它时应用程序读取的连接设置与在Visual Studio中连接时使用的凭据不同。通常这是因为您尚未正确部署包含凭据的Web.Config。
确定这是否属实; (1)查看您在IIS上部署的Web.Config的内容,(2)使用一些日志框架输出您在连接尝试期间读取的凭据(或者将它们写为HTML输出)。您可能会发现它们不是您认为的凭据。