Link to home
Start Free TrialLog in
Avatar of mwcorrell
mwcorrell

asked on

My application is not finding the Crystal DLLs

Hello Experts,

I am using crystal reports 11.5 in my web application, which is been built in Visual Studio 2003, and I am using DotNetNuke framework. The problem I am having is only in deployment computer. I do not have the problem in my development computer. My development and deployment computers both have windows 2003 server OS.
My development machine has Crystal Reports 11.5 developers edition installed.
I ran the redistribution package that come with Crystal 11.5, which is called CrystalRedist115_x86.msi, in my deployment machine. I noticed that the install created a folder in program files\business objects\common\35\managed and added some dlls.

The error that I am getting is

“DotNetNuke.Services.Exceptions.ModuleLoadException: File or assembly name CrystalDecisions.CrystalReports.Engine, or one of its dependencies, was not found”

When I add all the crystal’s DLLs to the bin folder of my application that error disappears; but I get another error. (I do not have the DLLs in my bin folder on my development machine)

“CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed. Error in File C:\WINDOWS\TEMP\IB_Daily_Transaction_Blotter {8FF2F0A8-BD78-41E1-89C8-668466A7B458}.rpt: Unable to connect: incorrect log on parameters”

I really do not know what is causing these errors. Could you pleaseeee help me? I will really appreciate you help

Thanks
Maria
Avatar of Mike McCracken
Mike McCracken

How are you passing the logon information?

mlmcc
Avatar of mwcorrell

ASKER

Hello mlmcc,

I have added 4 variable in the web.config file, which are the following :
   
    <add key="Servername" value="xxx"/>
    <add key="Databasename" value="yyy"/>
    <add key="Userid" value="zzz"/>
    <add key="Password" value="aaaa"/>

This variables are been used in the following sub. (This works great in the development machine and in another application in the deployment machine that is using crystal report 9)

Private Sub CreateReport(ByVal sReport As String, _
                         ByVal arParams As Array, _
                         Optional ByVal DoParams As Boolean = True)
            Dim oRpt As New ReportDocument
            Dim oSubRpt As New ReportDocument
            Dim Counter As Integer
            Dim crSections As Sections
            Dim crSection As Section
            Dim crReportObjects As ReportObjects
            Dim crReportObject As ReportObject
            Dim crSubreportObject As SubreportObject
            Dim crDatabase As Database
            Dim crTables As Tables
            Dim crTable As CrystalDecisions.CrystalReports.Engine.Table
            Dim crLogOnInfo As TableLogOnInfo
            Dim crConnInfo As New ConnectionInfo
            Dim crParameterValues As ParameterValues
            Dim crParameterDiscreteValue As ParameterDiscreteValue
            Dim crParameterRangeValue As ParameterRangeValue
            Dim crParameterFieldDefinitions As ParameterFieldDefinitions
            Dim crParameterFieldDefinition As ParameterFieldDefinition
            Dim crParameterFieldDefinition2 As ParameterFieldDefinition
            Dim strFile As String
            Dim fi As FileInfo
            Dim tstr As String
            Dim sPath As String
            Dim configurationAppSettings _
               As System.Configuration.AppSettingsReader = _
               New System.Configuration.AppSettingsReader
            Dim sReportPath As String = GetAbsoluteServerPath(Request) & "Reports\" & sReport
            Dim pos As Integer
            tstr = Microsoft.VisualBasic.Format(Now, "MM/dd/yyyy HH:mm:ss")
            strmessage = "Problem loading the Report"
            oRpt.Load(sReportPath)

            'log on to SQL server
            'Report code starts here
            'Set the database and the tables objects to the main report 'oRpt'
            crDatabase = oRpt.Database
            crTables = crDatabase.Tables
            'Loop through each table and set the connection info
            'Pass the connection info to the logon info object and then
            ' apply the logon info to the main report
            For Each crTable In crTables
                With crConnInfo
                    .ServerName = configurationAppSettings.GetValue("ServerName", GetType(System.String))
                    .DatabaseName = configurationAppSettings.GetValue("DatabaseName", GetType(System.String))
                    .UserID = configurationAppSettings.GetValue("UserID", GetType(System.String))
                    .Password = configurationAppSettings.GetValue("Password", GetType(System.String))
                End With
                crLogOnInfo = crTable.LogOnInfo
                crLogOnInfo.ConnectionInfo = crConnInfo
                crTable.ApplyLogOnInfo(crLogOnInfo)
                If (crTable.TestConnectivity()) Then
                    If (crTable.Location.IndexOf(".")) > 0 Then
                        crTable.Location = crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1)
                    Else
                        crTable.Location = crTable.Location
                    End If
                End If
            Next
            'Set the sections collection with report sections
            crSections = oRpt.ReportDefinition.Sections
            'Loop through each section and find all the report objects
            'Loop through all the report objects to find all subreport
            ' objects, then set the logoninfo to the subreport
            For Each crSection In crSections
                crReportObjects = crSection.ReportObjects
                For Each crReportObject In crReportObjects
                    If crReportObject.Kind = _
                       ReportObjectKind.SubreportObject Then
                        'If you find a subreport, typecast the reportobject
                        ' to a subreport object
                        crSubreportObject = CType(crReportObject, SubreportObject)
                        'Open the subreport
                        oSubRpt = _
                           crSubreportObject.OpenSubreport( _
                           crSubreportObject.SubreportName)
                        crDatabase = oSubRpt.Database
                        crTables = crDatabase.Tables
                        'Loop through each table and set the connection info
                        'Pess the connection info to the logoninfo
                        ' object then apply the logoninfo to the subreport
                        For Each crTable In crTables
                            With crConnInfo
                                .ServerName = _
                                   configurationAppSettings.GetValue("ServerName", _
                                  GetType(System.String))
                                .DatabaseName = configurationAppSettings.GetValue("DatabaseName", GetType(System.String))
                                .UserID = configurationAppSettings.GetValue("UserID", GetType(System.String))
                                .Password = configurationAppSettings.GetValue("Password", GetType(System.String))

                            End With
                            crLogOnInfo = crTable.LogOnInfo
                            crLogOnInfo.ConnectionInfo = crConnInfo
                            crTable.ApplyLogOnInfo(crLogOnInfo)
                        Next
                    End If
                Next
            Next
            ' Set the parameters
            If DoParams Then
                'Get the collection of parameters from the report
                crParameterFieldDefinitions = _
                   oRpt.DataDefinition.ParameterFields()
                For Counter = 0 To UBound(arParams) - 1
                    crParameterFieldDefinition = _
                       crParameterFieldDefinitions.Item(Counter)
                    '
                    'Get the current values from the parameter field.
                    crParameterValues = crParameterFieldDefinition.CurrentValues
                    If Not IsArray(arParams(Counter)) Then
                        'Test if param passed in matches CR param receiving
                        Dim test As String
                        Dim paramcounter As Integer
                        For paramcounter = 0 To UBound(arParams) - 1
                            ' Response.Write(arParams(paramcounter))
                            test = arParams(paramcounter)
                            ' Grabs param from CR and compares against param
                            ' passed in
                            If test.StartsWith(LCase(crParameterFieldDefinition. _
                               ParameterFieldName())) Then
                                                           test.Substring(test.IndexOf("=") + 1)
                                'Set the current values for the parameter field 0
                                crParameterDiscreteValue = New ParameterDiscreteValue
                                crParameterDiscreteValue.Value = _
                                   test.Substring(test.IndexOf("=") + 1)
                                'Add the first current value for the parameter field
                                crParameterValues.Add(crParameterDiscreteValue)
                               
                                Exit For
                            End If
                        Next
                    Else
                        crParameterRangeValue = New ParameterRangeValue
                        crParameterRangeValue.StartValue = arParams(Counter)(0)
                        crParameterRangeValue.EndValue = arParams(Counter)(1)
                        crParameterValues.Add(crParameterRangeValue)
                    End If
                    'All current parameter values must be applied for the
                    'parameter field.
                    crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
                Next
            End If
        End sub

Thank you
Maria
Nothing jumps out.  Are you using the correct user/password?  DOes the user have database permissions?

mlmcc
Yes, everything looks good.
I think the main question is why do I have to put the DLLs in the bin folder? My other applications do not need the dll in the bin folder.

Maria
I don't think they have to be in the bin folder but then I don't use the .Net version.  They do need to be registered.

mlmcc
Put the .dlls in the bin folder and see if in fact that is the issue....

MikeV

When I placed the DLLs in the bin folder the following error disapears
 "System.IO.FileNotFoundException: File or assembly name CrystalDecisions.CrystalReports.Engine, or one of its dependencies, was not found."

But I get the
"Unable to connect: incorrect log on parameters. ---> CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed. Error in File C:\WINDOWS\TEMP\IB_Daily_Transaction_Blotter {8FF2F0A8-BD78-41E1-89C8-668466A7B458}.rpt: Unable to connect: incorrect log on parameters"

Thanks for the help

Maria
Do you know which line is getting the error?

mlmcc
For the first error no: Here is the complete error message:

Message: DotNetNuke.Services.Exceptions.ModuleLoadException: File or assembly name CrystalDecisions.CrystalReports.Engine, or one of its dependencies, was not found. ---> System.IO.FileNotFoundException: File or assembly name CrystalDecisions.CrystalReports.Engine, or one of its dependencies, was not found. File name: "CrystalDecisions.CrystalReports.Engine" at DNNAdditional.SQLCrystalReportGrid.SQLCrystalReportGrid.CreateReport(String sReport, Array arParams, Boolean DoParams) at DNNAdditional.SQLCrystalReportGrid.SQLCrystalReportGrid.btnSearch_Click(Object sender, EventArgs e) === Pre-bind state information === LOG: DisplayName = CrystalDecisions.CrystalReports.Engine, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304 (Fully-specified) LOG: Appbase = file:///F:/WebSite/FHC LOG: Initial PrivatePath = bin Calling assembly : DNNAdditional.SQLCrystalReportGrid, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null. === LOG: Publisher policy file is not found. LOG: No redirect found in host configuration file (c:\windows\microsoft.net\framework\v1.1.4322\aspnet.config). LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\config\machine.config. LOG: Post-policy reference: CrystalDecisions.CrystalReports.Engine, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304 LOG: Attempting download of new URL file:///c:/windows/microsoft.net/framework/v1.1.4322/Temporary ASP.NET Files/fhc/7b5d4371/407fc2e5/CrystalDecisions.CrystalReports.Engine.DLL. LOG: Attempting download of new URL file:///c:/windows/microsoft.net/framework/v1.1.4322/Temporary ASP.NET Files/fhc/7b5d4371/407fc2e5/CrystalDecisions.CrystalReports.Engine/CrystalDecisions.CrystalReports.Engine.DLL. LOG: Attempting download of new URL file:///F:/WebSite/FHC/bin/CrystalDecisions.CrystalReports.Engine.DLL. LOG: Attempting download of new URL file:///F:/WebSite/FHC/bin/CrystalDecisions.CrystalReports.Engine/CrystalDecisions.CrystalReports.Engine.DLL. LOG: Attempting download of new URL file:///c:/windows/microsoft.net/framework/v1.1.4322/Temporary ASP.NET Files/fhc/7b5d4371/407fc2e5/CrystalDecisions.CrystalReports.Engine.EXE. LOG: Attempting download of new URL file:///c:/windows/microsoft.net/framework/v1.1.4322/Temporary ASP.NET Files/fhc/7b5d4371/407fc2e5/CrystalDecisions.CrystalReports.Engine/CrystalDecisions.CrystalReports.Engine.EXE. LOG: Attempting download of new URL file:///F:/WebSite/FHC/bin/CrystalDecisions.CrystalReports.Engine.EXE. LOG: Attempting download of new URL file:///F:/WebSite/FHC/bin/CrystalDecisions.CrystalReports.Engine/CrystalDecisions.CrystalReports.Engine.EXE. --- End of inner exception stack trace ---

For the second error YES:
Is in the oRpt.Export() line of the following piece of code

                    ExportFileName = exportpath & MyBase.UserInfo.Username.ToString() & commstmt & ".pdf"
                    oRpt.ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
                    oRpt.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
                    oDest.DiskFileName = ExportFileName
                    oRpt.ExportOptions.DestinationOptions = oDest
             oRpt.Export()
                    Dim strPortalAlias As String
                    Dim urlstring As String
                    strPortalAlias = GetPortalDomainName(PortalAlias.HTTPAlias, Request, False)
                    Response.RedirectLocation = "target=_blank"
                    Response.Redirect("http://" & strPortalAlias & "/export/" & MyBase.UserInfo.Username.ToString() &  commstmt & ".pdf", False)

Thanks

Maria
This is the complete error message for the second error

Message: DotNetNuke.Services.Exceptions.ModuleLoadException: Logon failed. Error in File C:\WINDOWS\TEMP\IB_Daily_Transaction_Blotter {A12F1110-2D02-4988-A103-0BC69A3CD0EF}.rpt: Unable to connect: incorrect log on parameters. ---> CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed. Error in File C:\WINDOWS\TEMP\IB_Daily_Transaction_Blotter {A12F1110-2D02-4988-A103-0BC69A3CD0EF}.rpt: Unable to connect: incorrect log on parameters. ---> System.Runtime.InteropServices.COMException (0x8004100F): Logon failed. Error in File C:\WINDOWS\TEMP\IB_Daily_Transaction_Blotter {A12F1110-2D02-4988-A103-0BC69A3CD0EF}.rpt: Unable to connect: incorrect log on parameters. at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) --- End of inner exception stack trace --- at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn) at Microsoft.VisualBasic.CompilerServices.LateBinding.LateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack) at DNNAdditional.SQLCrystalReportGrid.SQLCrystalReportGrid.ExportDataformat(Object& oRpt) at DNNAdditional.SQLCrystalReportGrid.SQLCrystalReportGrid.CreateReport(String sReport, Array arParams, Boolean DoParams) at DNNAdditional.SQLCrystalReportGrid.SQLCrystalReportGrid.btnSearch_Click(Object sender, EventArgs e) --- End of inner exception stack trace ---
Verify you have the correct information in the config file and that it is being read correctly.

mlmcc
ASKER CERTIFIED SOLUTION
Avatar of EwaldL
EwaldL

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello Everyone,
 Thank you for all your comments.

  I am still having the same problem. I have tried everything, including hardcodign the logon parameters,  but nothing new. I am still getting the error:

DotNetNuke.Services.Exceptions.ModuleLoadException: Error in File F:\WebSite\FHC\Reports\IB_Daily_Transaction_Blotter.rpt: Unable to connect: incorrect log on parameters. ---> CrystalDecisions.CrystalReports.Engine.LogOnException: Error in File F:\WebSite\FHC\Reports\IB_Daily_Transaction_Blotter.rpt: Unable to connect: incorrect log on parameters. at .L(String , EngineExceptionErrorID ) at .G(Int16  , Int32 ) at CrystalDecisions.CrystalReports.Engine.Table.TestConnectivity() at DNNAdditional.SQLCrystalReportGrid.SQLCrystalReportGrid.CreateReport(String sReport, Array arParams, Boolean DoParams) in C:\Inetpub\wwwroot\FHC\SQLCrystalReportGrid\SQLCrystalReportGrid.ascx.vb:line 5635 at DNNAdditional.SQLCrystalReportGrid.SQLCrystalReportGrid.btnSearch_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\FHC\SQLCrystalReportGrid\SQLCrystalReportGrid.ascx.vb:line 5470 --- End of inner exception stack trace ---

Any Other suggestion, pleaseeee.

Maria