Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deploy asp.net application with crystal reports on server

Status
Not open for further replies.

AzizKamal

Programmer
Apr 6, 2010
122
PK
I have developed an ASP.NET web application in Visual Studio 2010 professional edition. When I was done developing the web forms, I right-clicked the project in Solution Explorer and selected Publish Website. It generated compiled files in a folder. I copied that files in the application folder on the server. I copied files in that folder that has been mentioned in the physical path in my Site settings in IIS 8. The operating system on the server side is Windows Sever 2012 R2. Then I updated the web.config file for server side connection string.
Now, on my development machine, I installed SAP crystal reports version for visual studio 2010 from the following link:

I also installed 64-bit SAP crystal reports runtime engine for .NET Framework 4 from the following link:

After the successful installation, I created a sample report and it opened successfully in aspx page with crystal report viewer showing report data. Now I need to deploy the application having crystal report added to the server side. Do I only need to run Publish Web Site again and copy the files to the application folder or I will have to install something on server side as well to run and view crystal reports?
 
I installed 64-bit SAP crystal reports runtime engine for .NET Framework 4 on server side as well.

On my development machine, I tested the connection to crystal reports using a manual connection so that I could see if it also works on server. The code for ConfigureCrystalReports is as follows:

Code:
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        Try
            ConfigureCrystalReports()
        Catch ex1 As Exception
            Response.Write(ex1.ToString)
            Response.End()
        End Try
End Sub

Private Sub ConfigureCrystalReports()

        Try
            Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
            userreport.Load(Server.MapPath("rptUserList.rpt"))
            userreport.SetDatabaseLogon("sa", "123", "SERVER-1", "db1")
            myCrystalReportViewer.ReportSource = userreport
            myCrystalReportViewer.RefreshReport()
            
        Catch ex As Exception
            Response.Write(ex.Message)
            Response.End()
        End Try

End Sub

When I click on aspx link on development machine, Enter Values dialog box appears for database login credentials. I typed the password there and unchecked Use Integrated Security and clicked Log On. The report showed perfectly in the crystal report viewer. However, when I click the aspx link on server, neither the crystal report viewer nor the Enter Values dialog box is shown. I checked the aspnet_client folder. Two folders are in the system_web folder; 2_0_50727 and 4_0_30319. Both the folders contain the folder crystalreportviewers13. I also added the following lines in web.config:

Code:
<configSections>
<sectionGroup name="businessObjects">
<sectionGroup name="crystalReports">
<section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null" />
<section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
</sectionGroup>
</configSections>

<businessObjects>
<crystalReports>
<rptBuildProvider>
<add embedRptInResource="true" />
</rptBuildProvider>
<crystalReportViewer>
<add key="ResourceUri" value="/crystalreportviewers13" />
</crystalReportViewer>
</crystalReports>
</businessObjects>

However, the crystal report viewer is still not shown on the server.


 
The following solution finally worked for me.

I added the following lines in web.config file. It successfully opened the crystal report viewer:

Code:
<configSections>
    <sectionGroup name="businessObjects">     
      <sectionGroup name="crystalReports">       
        <section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler"/>     
 </sectionGroup>    
</sectionGroup>  
</configSections>   
<businessObjects>   
  <crystalReports>    
    <crystalReportViewer>        
      <add key="UseBrowserLocale" value="true"/>        
<add key="resourceURI" value="~/aspnet_client/system_web/4_0_30319/crystalreportviewers13" />      
</crystalReportViewer>    
</crystalReports>  
</businessObjects>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top