Crystall Report not working at server - c#

I am using crystal report for printing . But after hosting in the server i got a page with following url while printing from a client machine
http://192.168.50.104/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer4/html/crystalexportdialog.htm
and shows
Page not found
error
It is displayed in the report viewer, but the problem comes after clicking the print button of crystal report.
I am using the following code to bind report
CrystalReportViewer1.ReportSource = CrystalReport;
CrystalReportViewer1.DataBind();
If anybody knows the solution please help me.... Thanks in advance....

On a similar problem, this is what I did
This happens because crystal repots viewer assumes a very specific directory structure for the images and scripts. If you are running IIS on your development machine, you can find the structure here "C:\inetpub\wwwroot\aspnet_client\System_Web\2_0_50727\CrystalReportWebFormViewer4"
Now all you have to do is that copy the content of this whole structure, right from aspnet_client to your webserver and create a virtual directory to point to this path. Even if you dont want to create a virtual directory or dont have access to do so, you can simply copy the full structure to the root of your webapp and that should do the magic.
If you are not using IIS and using a inbuilt webserver with Visual studio (cassini i.e.), still you will have this structure , only thing that in this case it would be available at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ASP.NETClientFiles

Related

LocalReport - Render Excel returns 0-length byte array

I am using the LocalReport class to generate PDF/Excel files from an RDL.
In my local development machine, everything works perfectly, PDF and Excel files are rendered with the expected content.
However, after deploying to the QA server, Excel files are blank, only PDF work as expected. No exceptions are thrown and the Warning array that is populated on the Render() method is empty.
My guess is that a specific assembly/package is required for Excel creation, and that assembly/package exists on my machine but not on the server.
Do you guys have any idea if that could be the case and what may be missing?
Thanks a lot!
Well, I know this is not the answer you're expecting and certainly not the way I wanted to solve this problem. We tried installing, on the QA server, Report Viewer Runtime, Visual Studio Office Tools and some other packages that I lost track of, and Excel files were still blank.
Then I thought, why not try generating XLSX instead? So I changed
var renderedBytes = lr.Render
(
"EXCEL",
to
var renderedBytes = lr.Render
(
"EXCELOPENXML",
and it just worked. Hope this helps someone.
Cheers.

MS Word Customization can't find VSTO file

I've developed a customization in Visual Studio for Word 2010 and have the solution saved in network share (using a UNC path) and the actual Word document is saved in a folder in SharePoint.
Everything works fine, users can open the document and use the customisation and when they've gone through the steps the add-on requires they click a button which saves the completed document to a different location in SharePoint. Al good. When you however now open the newly saved document from SharePoint I get the following error message:
Cannot currently access the deployment manifest at this location:
"[URL to document path in SharePoint]". You muyst set the deployment
manifest location to a UNC share or a local path when
ClickOnceAddInDeploymentManager.RunFromFolder is true.
Have done some searches on these terms but getting nothing useful! Would appreciate any help you could offer!
Try this article:
http://msdn.microsoft.com/en-us/library/vstudio/bb772100(v=vs.110).aspx
Particularly the steps under the heading:
To put the document on a server that's running SharePoint
I don't think word trusts your document after you save it in a different location.
I figured out my problem, need to give a bit more background to explain the issue a bit better.
I'm using a number of Action Panes to create a wizard-like experience for the user. When the user hits "Next" on the first pane I have code (using ThisDocument.SaveAs2) so automatically do a Save As to a specific folder in SharePoint (actually the structure gets created on the fly before it being saved).
On the final pane when they hit Finish I was running the exact same code to Save As but to the exact same location and filename and this is what seems to have caused the problem. The bottom line is that the custom property _AssemblyLocation was changed somehow in this process to only have the filename of the vsto file without an absolute path, so on re-opening the document it was looking for this file in same location.
By simply changing this to a Save instead of a Save As it now works perfectly. Took me insane amounts of time to figure that out but my own fault!

Crystal report document load hangs

Whenever the program reaches the below code, the program hangs
protected void InitCrystalReport(String _reportUrl)
{
myReportDocument.Load(_reportUrl);
}
This situation only happens when I put the web on IIS (another server), but it doesn't exist when I run the application on Visual studio (Debug mode). I've also used process monitor to monitor the process to see if the file is access denied.
I've tried below on Web Server but none of them works:
Changing application pool to .NET Classic
Restart the printer spooler
Edit
I restarted the server and everything's OK now
I had this problem when i moved a new report to the test server. My fix was to set a specific printer through File.. Print.. to one i knew was on the server (in this case MS XPS Document Writer). Ensure you've used .dispose etc on the object when you're done.
Although this is old question already answered, I also encountered same problem and after wasting one whole day, I got suggestion from #PhilKemreen answer. Here is how I fixed it in my case:
Open report in Crystal Report Designer and Right Click
Select Design > Page Setup..., Page Setup Dialog box appears.
From the printer drop-down list, select Microsoft XPS Document Writer.
Click OK.
Then I deployed the new report file on server, it works.

Microsoft ReportViewer System.IOException with Subreports, RV Looking in Wrong Directory

I have several reports in a project I am working on that were created by someone else who no long works for the company. The reports all work fine, most have multiple subreports that work fine as well. One particular report that I have been working on also has multiple subreports but they are not working.
The subreports show up and display just as they should, so from the outside they look like everything is working just fine. However, when I display the report I get about 5 sets of System.IOExceptions for each subreport. The exceptions state that the subreport files cannot be found and for some reason it is looking for the subreport files in the 'c:/' directory. I cannot figure out why this happening and why it is happening for only this one report.
I know that the subreport files should be in the same directory as the report they are being used with and they are in fact there. I've looked through the source in each report and subreport file and nothing in them indicates any differences between the reports that don't throw the exceptions and the ones that do.
The problem was a file access rights issue. I had the project saved under the root directory but moving it to the default location ("Documents/Visual Studio 2010/Projects/") fixed the issue.

How to printing crystal report directly to network printer in Vb.net or C#.net in Windows Applications

I have written the following code as,
Dim report As New ReportDocument
report.PrintOptions.PrinterName = "\\network\printer"
report.Load(CrystalReportName.rpt, OpenReportMethod.OpenReportByDefault)
report.PrintToPrinter(1, False, 0, 0)
when i am trying to run this code , it shows the error message as "Invalid Printer Specified". If i give the local printer name, it is working fine. But i can't able to print the crystal report directly to the network printer. Kind help needed. Thanks in advance.
Sivakumar.P
Use this code to know the installed printers
Imports System.Drawing
Imports System.Drawing.Printing
and this code on the load function... you will fill a combobox with the printers and their names correctly, and then use your code
For Each Printer In PrinterSettings.InstalledPrinters
cmbPrinters.Items.Add(Printer)
Next
In case anyone else still has this problem:
In the crystal report document you are trying to print, go to:
Design --> Page Setup
A default printer not installed on your server side may have been selected. Remove or replace it and save the document. Then run your .Net code to set the printer dynamically if you want.
User 4 backslashes i.e \\ before Network
and 2 backslashes i.e \ before printername
\\\\[Network Address]\\[printer name]
May be the printer name is wrong.
Please use the following code to debug what name is coming while choosing the network printer
http://www.codeproject.com/KB/printing/printtoprinter.aspx
and then assign proper name.
Still if incase it did not work out, there might be a permission issue then look at
http://forums.asp.net/t/1383129.aspx
Best of luck,.
For anyone having a similar problem this can be a solution:
report.PrintOptions.PrinterName = "\\\\\\\\network\\\\printer"
In ASP.Net, a simple and sweet solution consists in install same printer drivers(like hp or zebraa) including version in both server and clinet meachine it will work with #\\\ipaddress\printername.

Categories