简体   繁体   English

IIS 7中的Crystal Report登录失败

[英]Crystal Report logon failed in IIS 7

I have used crystal report with VS2010 with IIS 7. I can connect the DB from WEB application. 我在带有IIS 7的VS2010中使用了Crystal Report。我可以从WEB应用程序连接数据库。 However, it throws "Logon Failed", if the application run with IIS 7. 但是,如果应用程序与IIS 7一起运行,则会抛出“登录失败”。

I tried with following VB.NET code 我尝试使用以下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()

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) 在IPSReport.btnViewPort_Click(Object sender,EventArgs e)的CrystalDecisions.CrystalReports.Engine.ReportDocument.VerifyDatabase()处,在System.Web.UI.WebControls的C:\\ inetpub \\ wwwroot \\ IPS_CrysRpt_VS2010 \\ Report.aspx.vb:line 383中。位于System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)处的System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)处的Button.OnClick(EventArgs e)。 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)处的Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 在System.Web.UI.Page.ProcessRequestMain处(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)

Could you please help me out to find the cause of error and solutions for it? 您能帮我找出错误原因和解决方法吗?

Thanks VG 感谢VG

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. 您尚未确定通过AppSettings静态类从Web.Config文件读取的值是否是您期望的值。

If by saying "I can connect the DB from WEB application." 如果说“我可以从WEB应用程序连接数据库”。 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. 您的意思是“我可以连接到Visual Studio中的数据库,但是在IIS下部署并运行时我的应用程序将无法连接”,那么答案是,当您在IIS下部署该应用程序时,该应用程序读取的连接设置与在Visual Studio中连接时使用的凭据。 Typically this is because you haven't deployed the Web.Config containing the credentials correctly. 通常,这是因为尚未正确部署包含凭据的Web.Config。

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). (1)查看您已部署在IIS上的Web.Config的内容,(2)使用某些日志记录框架输出您在尝试连接时正在读取的凭据(或仅将它们写为HTML输出)。 You will probably find they are not the credentials you think they are. 您可能会发现它们不是您认为的凭据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM