Crystal Report Load error with Local IIS - c#

I am trying to use Crystal Reports in my new web application.
I allready used it in an older project (VS 2008) and works great.
Now I want to use it in my new web application with Visual Studio 2015.
I installed Crystal report from http://scn.sap.com/docs/DOC-7824 , version 'v.13.0.15.1840'
And in my project I installed the Crystal.Report.Essentials from the Nuget Manager.
My code looks like this:
ReportDocument rptEHBOFiche = new ReportDocument();
rptEHBOFiche.Load("C:\\TEMP\\InputFiche.rpt");
Everytime I get the error that the loading of the report had failed.
I tried other paths but nothing is working.
Does anyone has a solution?
EDIT:
I found the problem, but not the solution.
The problem is this doesn't work if my project is on Local ISS. If it's on ISS Express I have no problem..
I have set the app pool to enable 32 bit applications too.

Can you try the following code?
if File.Exists ("C:\\TEMP\\InputFiche.rpt")
rptEHBOFiche.Load("C:\\TEMP\\InputFiche.rpt");
else
throw new Exception ("wrong path");
EDIT 2 Answer
In http://scn.sap.com/docs/DOC-7824 , "Install executable" is Crystal Reports Visual Studio integration. "MSI 64 bit" is IIS Runtime.
Install MSI 64 bit to have your IIS working. Don't lose your time on 32 bit apps, 64 bit work great.

I found the solution:
I needed to give my App Pool full rights to the c:\Windows\Temp folder

Related

The document has not been opened - Crystal report

I have some crystal reports on a website. They are working fine on my local machine. I'm using Crystal Reports version 13.0.3500.0
The test environment it is on another server, Windows 2008 R2, 64 bit operating system.
The problem is that when on the test environment I want to use a crsytal report, I get the following error: The document has not been opened
I spent some time already to figure it out what can be the problem, but without any success. I'm using the same DLL-s as in my local machine.
I checked and the folder where I have the report has all the rights.
Can you please advise?
if you are using IIS go to the application pool select your web site Click on Advanced Settings on the right side Set 'enable 32-bit application ' true (crystal report runtime engine for .net 32-bit had to be installed)
I was getting this error before I installed Crystal Reports Runtime (21) on my server.
Here is an article where you can find download links etc.

how to deploy crystal report 32bit on 64bit server

I have an asp.net web application developed in VS2010 which uses crystal report 13 (32bit) to generate report. on local machine, the reports works fine, but on the hosting server, the CrystalReportViewer does not appear, and there are no error message. I later learned that Crystal Reports Runtime for Visual Studio 2010 (x64) is installed on the server.
I have searched google and sap websites but no solution. my question is: is there a ways to get crystal report 32bit work on 64bit server? and how can I do that?
Any help will be greatly appreciated
I have been able to solve my own problem.
For those who may be facing the problem, please check this link

Crystal Reports version Issue

Hi I have developed windows app using c# to load the crystal reports dynamically from the code. In my development machine Crystal reports versions "10.5.3700.0" and "11.0.3300.0" installed. While building the app, by default 10.5.3700.0 version selected to my project while selecting the references of (CrystalDecisions.CrystalReports.Engine.dll,CrystalDecisions.ReportSource.dll,CrystalDecisions.Shared.dll,CrystalDecisions.Web.dll) and It works fine in my Dev server. If I moved the same exe file to another server, there only 11.0.3300.0 version installed. It was throwing could not load assembly version error. How do I build my application with 11.0.3300.0 ver and make it work in other server.
Please help me out ..
Thank you
Uninstall the version 10.5.3700.0 from your computer and use only 11.0.3300.0 everywhere.
I had many issues like that with Crystal Report. I finally change to ITextSharp to create my PDF file. Much easier.

C# vs 2008 crystal reports exception on client machine

my client machine is 64 bit but the application i build is in x86 target platform in C# Visual studio 2008 with win7 32 bit. Now the problem is when i click crystal report button on my application it gives me this error. It works perfectly fine on development machine but on client i just see this message box again and again.
"An error has occurred while attempting to load the Crystal Reports runtime.
Either the Crystal Reports registry key permissions are insufficient or the Crystal Reports runtime is not installed correctly."
I have checked crystal reports even in prerequisites just like the attached picture
Also i have installed manually crystal reports runtime from http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_redist_install_32bit_13_0.zip
But error seems not leaving my life at all.
I am using first time crystal reports in C# but it gave me very hard time just to install it on the client machine. I have googled and found solutions most of them i have tried like setting prerequisites and changing mode from Any CPU to x86 but none has fix my error.
IIRC I've had a similar problem in the past caused by deploying Crystal with the Setup package. Have you tried uninstalling Crystal Runtime from the target machine and installing the correct (64-bit) runtime version onto it directly?
You can leave your target CPU as Any.
I found the answer what i did is i have opend the directory in my development machine C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5 and copied the runtime exe for crystal reports and than i have ran it manually on the client machine. By doing this my client machine is now able to run crystal reports perfectly fine. I believe i should store this crystal report runtimes in my setup program for other clients.
Your application is targeting x86 version and you are installing in 64 bit machine,right?
I think crpt x64 installer is corrupted.
After making installer,go to debug folder and find crystal report folder.You can see two crpt installer,one is x86 and another is x64. Delete x64 installer. copy x86 to another place and rename it as x64.Then recopy to crpt folder.Now check installation.
I think I can make you understand.

Crystal Report in .NET Framework 4.0

We've a WPF application written in .NET 3.5 using Visual Studio 2010. The solution consists of 8 projects - all compiled in .NET 3.5. The application uses Crystal Report. Target OS is Windows 7.
Recently, the startup project is compiled in .NET 4.0 due to some 3rd party DLL dependency - those DLLs require .NET 4.0. After this change and rebuilding the solution, Crystal Report is throwing exception.
The problem occurs at the constructor of ReportClass.
Exception's message:
The type initializer for
'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an
exception.
InnerException's message:
"Retrieving the COM class factory for component with CLSID
{4DB2E2BB-78E6-4AEA-BEFB-FDAAB610FD1B} failed due to the following
error: 80040154 Class not registered (Exception from HRESULT:
0x80040154 (REGDB_E_CLASSNOTREG))."
I haven't worked in Crystal Report before. What could be the cause of this problem?
Please note that this problem doesn't occur when compiled as .NET 3.5. Crystal Report is used in the startup project.
It is likely to be X86/x64 problem.
try to compile your app to target 86 platform.
This issue got me for 2 days and its all over the place with very similar answers, however what it ended up being for me was two-fold. I am adding here in hopes it saves someone at least a day..
A lot of post mention this;
Go to IIS -> application pools -> click right button on your application pools -> go to advance setting -> Enable 32 bit application = True
Please note that in my case I was building and deploying on a 64bit machine so I set the True to False and it did it. Again, simple enough but not something I thought was related so my mind was blank to it after I made the adjustment.
The other point of interest is to make sure that you do have the CRRuntime_xx.x.x.MSI loaded on Deployment server.
Thank you everyone here for the amazing info at the end of the day it got me through.
Go to IIS -> application pools ->click right button on your application pools -> go to advance setting -> Enable 32 bit application = True
When you install CR it should install few files (JS,html etc etc) on C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13. Check if this folder exists on your pc. If not, I think you need to copy the folder from program files to this location.
These answers got us to the right place but not until we did some troubleshooting. It did end up being a 32/64 bit issue on our local dev machines running Visual Studio 2019 and IIS Express.
In our case the issue was that the setting for "Use the 64 bit version of IIS Express for web sites and projects" had been enabled in visual studio settings. We use the 32 bit version of crystal on our dev machines so we had to Uncheck this box for it to work correctly.

Categories