Crystal Report - Load report failed - c#

I am using Crystal Report (10.2.3600.0) in Windows Application using c#.net 2.0.
I have deployed the application in many of the clients machine. Until recently it was found out that in one of the machine the report is not working.
From the log file following error is shown -
StackTrace: at
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
at
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String
filename, OpenReportMethod openMethod,
Int16 parentJob) at
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String
filename, OpenReportMethod openMethod)
at
FlexiPackOfficeAutomation.frmJobCardViewer.PopulateReportFields()
InnerException: The system cannot
find the path specified.
One important thing which i noticed in that machine is that there is no C Drive. The windows is installed in H: Drive. I am not sure whether this is causing the issue.
The code which i am using to load the report is as follows,
CrystalDecisions.CrystalReports.Engine.ReportDocument JobCard1 = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
cFPWebService objWS = new cFPWebService();
//Get the Job Details from the Webservice
DataSet mDsJobDetails = objWS.ObjWebService.GetJobDetails_ForCrystalReport(this._JobID);
string FileName = "rassdk://" + Directory.GetCurrentDirectory() + #"\reports\JobCard.rpt";
//Load the Crystal Report File
JobCard1.Load(FileName, CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy);
//Set the reportsource of the Crystal Report Viewer as this JobCard
crvJobCard.ReportSource = JobCard1;
I have tried the following on the clients machine
Reinstalled the crystal report Runtime
Reinstalled the software
Thanks,

Search the entire registry for "Crystal". You'll find a key or two that is probably incorrect in pointing to the v10 DLLs on the C drive.
If you'll update the registry keys to the correct H drive location, it should work.

Found this troubleshooting document at SAP. Looks like there's a section on installs without a C: drive. The relevant section:
Missing “C:\” drive
The application is deployed to a computer that does not have a “C:” drive. When the Crystal Reports runtime is installed via the msm or msi files, certain registry values are set to point to the C: drive. To resolve this issue modify registry values in the Registry Editor. ...
At minimum, it will be necessary to modify the following string values:
CommonFiles
Path
ConnectionDirectoryPath
ChartSupportpath
ReportDirectoryPath
The location of these string values varies depending on the version of Crystal Reports used. Search the registry on the development computer and study the appropriate keys. Modify as needed on the runtime computer.
To troubleshoot these issues, a utility such as Process Monitor will prove useful.
This wasn't my issue, but perhaps this will help.

Related

Crystal Reports mvc

I made an application with c# mvc 4.8 and I have few reports made with crystal reports.
On Visual Studio 2019 on debug is working perfectly. Once I made a deploy to local IIS the reports not working.
I have the below error. May I have to add something in config file? I have already install runtime sap latest version 64 bit.
Report Cannot be printed CrystalDecisions.Shared.CrystalReportsException: Load report failed. ---> System.Runtime.InteropServices.COMException: The system cannot find the file specified.
at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
--- End of inner exception stack trace ---
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
at ArsWeb.Controllers.ReportsController.ActivityLogReport(ActivityLog model)
Any solution?
Thanks
Normally, there are 2 reasons for this error, you can try the following methods to solve the problem.
Permission issue
The application must have access to the Temp folder. You have two choices to solve this (Choose any one).
1.How to Assign Permissions for the Windows Temporary Folder on the Web Servers.
2.ASP.NET Impersonation.
ASPNET machine account to be added to the Temp directory, so we have to specify username and password attributes for tag in Web.config file for identifying the IIS Authenticated Account or User.
<identity impersonate="true" userName="accountname" password="password" />
Invalid File path or File name
1.Ensure the Report file name is correct (may be Typo or something. Example: Repotr1.rpt instead of Report1.rpt).
2.Ensure the Report path is correct (Example: "Reports/Report1.rpt" instead of "~/Reports/Report1.rpt").
3.Actually some of us forget to copy the report files to the publish folder (IIS virtual directory).

Crystal report registery key permission error, with using crystalreportviewer in C#

In a C# Windows form project, I used "CrystalReportViewer" control to view ".rpt" files. It works correctly and loads rpt files correctly. But...
Unfortunately, in other systems, it's exe file encountered with this error:
Ether the Crystal Reports registry key permissions are insufficient ...
Therefore the rpt files can't be shown!
What is the problem in other systems????
My project is created in Visual Studio 2015.
And in other systems, I run and installed the x86 and x64 CRRuntime (version 18, and older)
the versions 10 and 11 of crystal report are installed in all systems, and they registered correctly.
I tested this: compiling exe by setting the "Target Framework" on ".NET Framework 4" and "4.5". Unfortunately, it has same error...
In all my tests, the rpt files there are in the current path of exe.
Please Help Me!
thank you
//***** This is my testing code:
private void crystalReportViewer1_Load(object sender, EventArgs e)
{
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(strRptPath);
cryRpt.DataSourceConnections[0].SetConnection("MyServer", "DBName", false);
cryRpt.DataSourceConnections[0].IntegratedSecurity = true;
cryRpt.SetParameterValue("CenterName", strCenterName);
cryRpt.RecordSelectionFormula = "{Table.Field} = 'value'";
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();
}
This could be an issue that Crystal Runtime installer for legacy crystal reports not playing well with modern windows operating system as crystal report is sold out to SAP and now superseded by new reporting infrastructure like BI etc.
I've tackled such issue in migrating VB6 Crytal Reports to Windows 10 (x64) without modifications. Here Runtime Installers are not made for VB6. In my opinion reverse engineer and generate installer from crytal libraries of working node and use it to install on any system w.r.t your code. Also make sure to check Register for COM Interop option in project settings. At times it also helps.
Have you checked the regedit permissions for the CR for the user?
Set the user permissions for the selected folder to "Full Access".
For Crystal Reports XI:
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Business Objects\Suite 11.0\
(on 64 bit OS)
HKEY_LOCAL_MACHINE\Software\Business Objects\Suite 11.0\ (on 32 bit
OS)
HKEY_CURRENT_USER\Software\Business Objects\Suite 11.0\
For Crystal Reports 10:
HKEY_LOCAL_MACHINE\Software\Crystal Decisions\10.0\
HKEY_CURRENT_USER\Software\Crystal Decisions\10.0\

.NET executables do not work after overwritten with new versions

I faced very strange behaviour - after I overwrite .NET exectables with new versions from network drive it cannot start.
When try to start from Windows Explorer it shows me following error:
[Window Title]
C:\Programs\zzz\clients.net\zzzNet.exe
[Content]
C:\Programs\zzz\clients.net\zzzNet.exe
The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
I tried to execute following commands:
SxsTrace Trace -logfile:SxsTrace.etl
SxStrace Parse -logfile:SxSTrace.etl -outfile:SxSTrace.txt
And got following result:
=================
Begin Activation Context Generation.
Input Parameter:
Flags = 0
ProcessorArchitecture = AMD64
CultureFallBacks = en-US;en;ru-RU;ru
ManifestPath = C:\Programs\zzz\clients.net\zzzNet.exe
AssemblyDirectory = C:\Programs\zzz\clients.net\
Application Config File = C:\Programs\zzz\clients.net\zzzNet.exe.Config
-----------------
INFO: Parsing Application Config File C:\Programs\zzz\clients.net\zzzNet.exe.Config.
INFO: Parsing Manifest File C:\Programs\zzz\clients.net\zzzNet.exe.
INFO: Manifest Definition Identity is (null).
ERROR: Line 0: XML Syntax error.
ERROR: Activation Context generation failed.
End Activation Context Generation.
It is quite simple .NET application (1 exe + 8 dll files). It was built for .NET 3.5 Client Profile.
I not defined any special "manifest" there. Just clicked "New Windows Forms Project" in Visual Studio and developed it.
Also app.config does not contain anything special - only primitive standard settings - appSettings and userSettings sections.
On PC where I developed it all is perfectly works. Problems only began when I copy these binaries to this particular VM and try to start.
Also please note - these executables were not installed in GAC or such, I just copied them into a folder on VM and started. And when it was 1st time all was working fine.
So, the problem pattern is following:
Copy .NET execuatbles to new VM (it is Win 7 x64), run it, all is working fine. Close it.
Build new version of .NET execuatbles on host PC, copy new .NET execuatbles to VM (with files overwriting).
Try to start - got mentioned problem.
After some shaman-style actions (like OS reboot, etc) it begin to work but why that happened at all?!
Why replacing .NET executables with new versions is causing SUCH HUGE PROBLEMS?!
Also the BIG QUESTION - is there any special procedure to replace .NET executables to keep them working? Because it is a new app development, I do not want lost so much time on every new executables installation. :-\
Could you please help? Because it looks completely weird!
Thank you in adance.
PS. I checked all VS projects - all they have PlatformTarget=AnyCPU. Also in run-time I can see ProcessType=MSIL (I show this info in AboutBox for application). So, there is no mix of x86/x64 binaries.
It seems that was related to mapped network drive behavior.
When I copied new files from network drive folder it copied wrong files - a strange random mess of new files and older ones (which were there before I updated them on VM host).
The scenario to make it working:
on VM: delete all files in a folder on network drive
on VM host: copy new files into a folder which is mapped as network drive on VM
on VM: copy files into target folder
on VM: run application - it works now
Weird thing. I remember I have seen something similar with Windows Explorer on Windows 2008 behaviour when copying updated win32 binaries.

Excel VSTO addin deployment error

I am developing a plug-in (ribbon) for Excel in Visual Studio 2013 using C# and VSTO.
So far, so good. Now, I want to create an installer. I am using InstallShield Limited Edition for Visual Studio. I followed the instructions given here http://msdn.microsoft.com/en-us/library/cc442767.aspx (Per-user installation, application-level add-in).
The compilation and setup work out without any problems. However, when I open Excel, I get this warning:
Name:
From: file:///C:/Program Files (x86)/DCDB/ExcelInterface.vsto
************** Exception Text **************
Microsoft.VisualStudio.Tools.Applications.Deployment.InstallAddInFailedException: The customization cannot be run because
the solution ID in the document does not match the customization. Contact your administrator for further assistance.
at Microsoft.VisualStudio.Tools.Office.Runtime.OfficeAddInDeploymentManager.RefreshCustomization(Customization cust,
AddIManifestsDownloadedArgs args)
at
Microsoft.VisualStudio.Tools.Office.Runtime.OfficeAddInDeploymentManager.OnAddInManifestsDownloaded(AddInManifestsDownloade
dArgs args)
at
Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.RaiseOnAddInManifestsDownloadedEvent(I
ClickOnceAddInInstaller addInInstaller, Uri deploymentManifestUri, AddInInstallationStatus addinSolutionState, String
productName, String deploymentManifestXml, String applicationManifestXml, String hostManifestXml, String logFilePath,
String version, Uri supportUri)
at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.InstallAddIn()
at Microsoft.VisualStudio.Tools.Office.Runtime.SolutionInstaller.<>c__DisplayClass7. <Install>b__0()
I have been searching on the net and there is no answer, only questions.
I cannot understand the nature of the error message. Any ideas?
For anyone out there that encounters this problem in the future. I found that the problem is not a real problem. I was able to close the error message and open the Excel File directly and it worked fine.
I did add the solution ID to the Manifest value after the the filename: file:///[INSTALLDIR]ExcelWorkbook.vsto|SOLUTIONID|vstolocal.
But I'm not sure that actually made a difference. I still got the same error.
I added a shortcut to the ExcelWorkbook.xlsx to the end users desktop which helped to ensure that the end user will open the Workbook directly, and not Excel.

Firebird client installation

I'm trying to deploy my Application that uses a Firebird v2.5 database to a client machine.
I am trying to use a minimum installation, without the need to run any other installers. From what I gather, all I need to do is copy the "FBClient.dll" to the target application folder (which includes firebird database file). I have tried this and it still reports an error about not being able to find the correct .net data provider.
eg
C:\Program Files (x86)\MyApp\myApp.exe
C:\Program Files (x86)\MyApp\fbDatabase.fdb
C:\Program Files (x86)\MyApp\fbclient.dll
The error produced is:
Failed to find or load the registered .Net Framework Data Provider.
Also have copied, renamed and included fbclient.dll as fbembed.dll
I have also tried to copy a bunch of other files to the app directory, as well as placing fbclient.dll into the c:\, c:\windows, c:\windows\system.
I also tried installing the client installation, with no joy too.
Is there a way, that I can use the firebird database, without manually editing the machine.config files or using the gac and going through the hell that I went through to install firebird on the dev machine? I want an application that a user can install, not requiring that it be installed by a developer.
Please note, the application that I am writing is for a single machine, single user environment, who knows how to double click the install button, with the attention span of a gnat, that if required to do more than double click install and then press GO, will simply get bored and press the cancel, forget it button.
I add the file "FirebirdSql.Data.FirebirdClient.dll" to the application folder and I no longer get the Data provider error, instead I get the following
"Unable to complete network request to host \"DevMachine\"."
at FirebirdSql.Data.Client.Managed.Version10.GdsConnection.Connect()
at FirebirdSql.Data.FirebirdClient.ClientFactory.CreateManagedDatabase(FbConnectionString options)
at FirebirdSql.Data.FirebirdClient.ClientFactory.CreateDatabase(FbConnectionString options)
at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect()
I am trying to connect with the following
string file = #"C:\Program Files (x86)\MyApp\Test.FDB;";
FbConnection con = new FbConnection("User=SYSDBA;" + "Password=masterkey;" + "Database=" + file + "DataSource=Dev-VS-W7VM;" + "Port3050;" + "Dialect=3;" + "Charset=ISO8859_1;");
try
{
con.Open();
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
I have included FirebirdSql.Data.FirebirdClient in my project and installation folder (..\MyApp)
Thank you in advance.
You have to grap a zip and copy FirebirdSql.Data.FirebirdClient.dll to bin folder.
I wonder how you wrote your application that it works without the file (probably installed .msi) :)
You needed to install .net provider
http://www.firebirdsql.org/en/net-provider/
The database file resides next to your application's exe module. So, you need in local server running or embedded server in order to work with data. For embedded server a minimal set of files is (specifed relatively to an application folder):
\UDF (folder with UDF needed if any)
\Intl (with contents from FB installation)
fbembed.dll
firebird.msg
ib_util.dll
icudt30.dll
icuin30.dll
icuuc30.dll
Microsoft.VC80.CRT.manifest
msvcp80.dll
msvcr80.dll
for a full scale server (i.e. not an embedded) a list of files would be:
\UDF (folder with UDF needed if any)
\Intl (with contents from FB installation)
fbserver.exe or fb_inet_server.exe
fbclient.dll
firebird.msg
ib_util.dll
icudt30.dll
icuin30.dll
icuuc30.dll
Microsoft.VC80.CRT.manifest
msvcp80.dll
msvcr80.dll
security2.fdb
firebird.conf (if non default parameters used)
But then you would need in setting up service record for FB
or start it as an application before your application start.
Installation of the Firebird as a service could be done with
instsvc.exe utility. Appropriate commands:
instsvc install -s -a
instsvc start
Also you should take care of two things:
FileName must be a local file, not in a shared folder from another server.
Appending the firebird server IP before the filename. If you are running your app always in the firebird server, or you are using embeded fbclient.dll, than it should be like
FbConnection con = new FbConnection("User=SYSDBA;" + "Password=masterkey;" + "Database=localhost:" + file + "DataSource=Dev-VS-W7VM;" + "Port3050;" + "Dialect=3;" + "Charset=ISO8859_1;");
Some fbclient.dll version will allow you not to add localhost and still connect on local files, or use \\servername\c:\filename format instead of localhost:c:\filename, but it is deprecated and not supposed to work anymore (and can work depending on windows version).

Categories