Connecting Tech Pros Worldwide Forums | Help | Site Map

deploy crystal report on asp.net server

parshupooja's Avatar
Familiar Sight
 
Join Date: Jun 2007
Posts: 159
#1: Jan 30 '08
Hey All,

I have created asp.net application which includes crystal report page on my local machine, it works fine. but when i try to deploy it to remote server it throws error. I was not even being able to build the solution than i did good I found solutions that we need to include DLL in Bin folder, it included and updated the reference. Now I am able to build solution but when I try to run application it throws error on crystal report page on bold italic line

Error:
The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocu ment' threw an exception.
code
Expand|Select|Wrap|Line Numbers
  1.  
  2.     protected void Page_Load(object sender, EventArgs e)
  3.     {
  4.                // object declration 
  5.         CrystalDecisions.CrystalReports.Engine.Database crDatabase;
  6.         CrystalDecisions.CrystalReports.Engine.Table arTable;
  7.         CrystalDecisions.CrystalReports.Engine.Table brTable;
  8.         CrystalDecisions.CrystalReports.Engine.Table crTable;
  9.         CrystalDecisions.CrystalReports.Engine.Table drTable;
  10.  
  11.         TableLogOnInfo dbConn = new TableLogOnInfo();
  12.         // new report document object 
  13.         ReportDocument oRpt = new ReportDocument();                // loading the ItemReport in report document 
  14.         oRpt.Load(Server.MapPath("------.rpt"));
  15.  
  16.         // getting the database, the table and the LogOnInfo object which holds login onformation 
  17.         crDatabase = oRpt.Database;
  18.  
  19.  
  20.         // getting the table in an object array of one item 
  21.         object[] arrTables = new object[4];
  22.  
  23.         crDatabase.Tables.CopyTo(arrTables, 0);
  24.  
  25.  
  26.         // assigning the first item of array to crTable by downcasting the object to Table 
  27.         arTable = (CrystalDecisions.CrystalReports.Engine.Table)arrTables[0];
  28.         brTable = (CrystalDecisions.CrystalReports.Engine.Table)arrTables[1];
  29.         crTable = (CrystalDecisions.CrystalReports.Engine.Table)arrTables[2];
  30.         drTable = (CrystalDecisions.CrystalReports.Engine.Table)arrTables[3];
  31.  
  32.         dbConn = arTable.LogOnInfo;
  33.         dbConn = brTable.LogOnInfo;
  34.         dbConn = crTable.LogOnInfo;
  35.         dbConn = drTable.LogOnInfo;
  36.  
  37.  
  38.         dbConn.ConnectionInfo.DatabaseName = "--";
  39.         dbConn.ConnectionInfo.ServerName = "--";
  40.         dbConn.ConnectionInfo.UserID = "--";
  41.         dbConn.ConnectionInfo.Password = "---";
  42.       dbConn.ConnectionInfo.IntegratedSecurity= true;
  43.  
  44.         // applying login info to the table object 
  45.         arTable.ApplyLogOnInfo(dbConn);
  46.         brTable.ApplyLogOnInfo(dbConn); 
  47.         crTable.ApplyLogOnInfo(dbConn); 
  48.         drTable.ApplyLogOnInfo(dbConn);
  49.         // defining report source 
  50.         CrystalReportViewer1.ReportSource = oRpt;
  51.  
  52.         setReportParameters(); 
  53.  
  54.   -    }
  55.  
  56.  
any help appreciated

DrBunchman's Avatar
Moderator
 
Join Date: Jan 2008
Location: Winchester, UK
Posts: 930
#2: Jan 30 '08

re: deploy crystal report on asp.net server


Have you checked if CrystalReports for .NET Framework 2.0 has been installed on the server? If you're lucky it could be as simple as that!

Dr B
parshupooja's Avatar
Familiar Sight
 
Join Date: Jun 2007
Posts: 159
#3: Jan 30 '08

re: deploy crystal report on asp.net server


thanks but How do i find out that? if its not there on server, is it necessary to install there, cant I deploy without installing there?


Quote:

Originally Posted by DrBunchman

Have you checked if CrystalReports for .NET Framework 2.0 has been installed on the server? If you're lucky it could be as simple as that!

Dr B

DrBunchman's Avatar
Moderator
 
Join Date: Jan 2008
Location: Winchester, UK
Posts: 930
#4: Jan 31 '08

re: deploy crystal report on asp.net server


I think if you check Control Panel - Add/Remove Programs it will display which .Net components are installed.

In order to install the Crystal Reports for .Net Framework 2.0 you need to create an installer by following these steps:
  1. Go to create a new project in Visual Studio
  2. Select 'Other Project Types' from the New Project dialog box then select 'Setup and Deployment' and Ok
  3. Right click the project in the solution explorer and go to properties
  4. Click the 'Prerequisites' button
  5. Check both MDAC 2.8 and Crystal Reports for .Net Framework 2.0 then Ok
  6. Compile the project and your installed should be in the release folder. Run the .msi file on the deployment server.
Hope this helps.

Dr B
parshupooja's Avatar
Familiar Sight
 
Join Date: Jun 2007
Posts: 159
#5: Jan 31 '08

re: deploy crystal report on asp.net server


thanks fro replying again. server where i am working does not have visual studio, they have web devloper and web developer there is no option called as new project. there is new website option in web developer, when i click it does not show other project types.

Can this be done in web devloper as i have no right to install anything there?

thanks

Quote:

Originally Posted by DrBunchman

I think if you check Control Panel - Add/Remove Programs it will display which .Net components are installed.

In order to install the Crystal Reports for .Net Framework 2.0 you need to create an installer by following these steps:

  1. Go to create a new project in Visual Studio
  2. Select 'Other Project Types' from the New Project dialog box then select 'Setup and Deployment' and Ok
  3. Right click the project in the solution explorer and go to properties
  4. Click the 'Prerequisites' button
  5. Check both MDAC 2.8 and Crystal Reports for .Net Framework 2.0 then Ok
  6. Compile the project and your installed should be in the release folder. Run the .msi file on the deployment server.
Hope this helps.

Dr B

DrBunchman's Avatar
Moderator
 
Join Date: Jan 2008
Location: Winchester, UK
Posts: 930
#6: Feb 1 '08

re: deploy crystal report on asp.net server


Do you use Visual Studio on your development machine?
parshupooja's Avatar
Familiar Sight
 
Join Date: Jun 2007
Posts: 159
#7: Feb 5 '08

re: deploy crystal report on asp.net server


i have visual studio 2005 on machine where I developed application, crystal report works fine on it. but on server where I am trying to deploy, has web developer.

Quote:

Originally Posted by DrBunchman

Do you use Visual Studio on your development machine?

DrBunchman's Avatar
Moderator
 
Join Date: Jan 2008
Location: Winchester, UK
Posts: 930
#8: Feb 6 '08

re: deploy crystal report on asp.net server


Go through the steps I outlines above on your machine with Visual Studio then copy the deployment file to the server and run it.

Let me know how it goes,

Dr B
parshupooja's Avatar
Familiar Sight
 
Join Date: Jun 2007
Posts: 159
#9: Feb 6 '08

re: deploy crystal report on asp.net server


ok I tried following steps provided but you did not mention which template to choose from other project -setup and deployment, I tried choosing setup first and make sure of 'Prerequisites' . but when i tried to build the project in it starts windows installer and asks me the location of SqlRun_Tools.msi. I tried to use my sql server disc but it doesnot let me install it.
I tried choosing other types of templates under -setup and deployment but I have same issue


/mergemodule/websetup one by one
any suggestion?
Thanks,
Quote:

Originally Posted by DrBunchman

Go through the steps I outlines above on your machine with Visual Studio then copy the deployment file to the server and run it.

Let me know how it goes,

Dr B

DrBunchman's Avatar
Moderator
 
Join Date: Jan 2008
Location: Winchester, UK
Posts: 930
#10: Feb 8 '08

re: deploy crystal report on asp.net server


Hmm not sure about that one...when I did this I didn't come across any problems. Anyone else got a suggestion? I'll do a little research and see what I can come up with.

Sorry I can't be more help at this stage.

Dr B
parshupooja's Avatar
Familiar Sight
 
Join Date: Jun 2007
Posts: 159
#11: Feb 8 '08

re: deploy crystal report on asp.net server


Thanks for help,

Finally I client has been convinced to install visual studio 2005 on server.I am sure it will resolve the problem

Regards,

Quote:

Originally Posted by DrBunchman

Hmm not sure about that one...when I did this I didn't come across any problems. Anyone else got a suggestion? I'll do a little research and see what I can come up with.

Sorry I can't be more help at this stage.

Dr B

Reply