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.
Related
I am writing a Crystal Report Viewer in Visual Studios using ClickOnce to deploy updates and install on users computers. I am using Visual Studios C# and have the application checking for updates before loading the program to ensure all users have the latest version when needed.
One thing that I did not think about and just ran into is the number of reports attempting to load at once on a machine. Some users have 10+ reports starting simultaneously when they log into our ERP. I made a batch file to start all the reports they needed but I ran into an error:
Too many deployed activations are attempting to load at once
I tried searching for an answer as to how many ClickOnce instances are allowed to load at once and I could not find the answer. It seems to be around is 8 (based on my testing) and apparently it is in place to prevent DOS attacks against the ClickOnce server. I tried waiting a few seconds in the batch file after every 5 reports or so but this is not a long term solution.
Is there a way to increase this limit or should I just open all the reports needed in a single instance from a command? Even if I go with the second option, users can still add reports to automatically open in the ERP causing this issue to arise again. So is there a way to detect how many ClickOnce instances are currently loading and wait for them to finish, allowing me to bypass this issue entirely?
The solution I came up with for this was to expand the command to include multiple reports so all the reports will open under the same program. That way, ClickOnce is only involved once per batch file. Each report runs in its own thread so it behaves the same as running each report as a new instance of the program.
Theoretically a user could add enough batch files to our ERPs auto launch feature to overload the system and receive the same error as before but we could just add that to the batch file once we find out.
Until I find out if there's any way around this limit, this is the best I can come up with since it seems to be happening before the program even hits main().
(Sorry for my bad english)
Hi I have a problem.
I need to open the associated files already in my program while it is running.
If we take example visual studio, when I opened the ide and I double-click on a file example test.cs
Do not opening a new application,
But he added a tab with the new file.
And 'possible to do such a thing?
As you've observed, Windows Explorer will try to launch a new instance of your app when you double-click a file associated with your application. You can't change that. What you can do is have the new instance check whether an instance is already running and, if so, tell the running instance to load the file. There are lots of ways to establish this sort of communication. You could listen on a port, periodically check for a file in a particular location, etc. How to do it is up to you.
I have the following code:
Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Internet Explorer\\iexplore.exe", "http:\\\\someurl.com");
It runs fine, but opens two instances of IE (Needless to say, I'm expecting one). Is there something obvious I'm missing here, or is it a more detailed issue? I'm using Visual C# 2010 Express if that matters, and .NET 4 Client Profile.
Try removing the exe path to IExplore and just let Process start the link, in my experience this should open in a new Tab not window
Example:
Process.start("http:\\\\someurl.com");
I have a bit of a strange problem, in my program, when I open a PDF file using the following command:
Process.Start("test.pdf");
the first time, the file is opened just fine, but the second time I use this command on ANY pdf file, at ANY position in the code, vshost.exe crashes.
My next step was to disable vshost, with vshost disabled, the application its self crashes.
When I say 'crashes' I mean it says that it has stopped responding.
If I create a new project, it works just fine, so it must be something wrong with my project?
I am using the iTextSharp library at other points in the code to create the pdfs, could this be a cause?
I realise this problem is very general but I have no idea what could be causing it so I dont know what information to provide.
More info:
When I look at the output of the debugger after the program crashes it says "The program '[4320] SmartShelf.exe: Managed (v4.0.30319)' has exited with code -1073741819 (0xc0000005) 'Access violation'."
Edit: Does anybody know any other way of viewing a pdf using c#?
I would use using context or the dispose command to get rid of any open file connections before calling the start("asdf.pdf") and see if that takes care of it.
Also make sure your process is running as admin in win7.
And another thing you can try is use process.start(cmd, "aspdf.pdf") this way your starting a command window and it calls the pdf starter.
Although not perfect, my solution in the end was to display the pdf in a webBrowser control, by setting the URL to the path of the PDF using
webBrowser1.Navigate("asdf.pdf");
this displayed it in adobe reader but within a web browser.
This solution suited my needs absolutely fine (if not better) and doesn't cause the application to crash. Thanks for everybody's suggestions.
We have a .NET Winforms application that hosts the Crystal Reports Viewer control (Version XI). It works well for the most part but when an export of data from the viewer is performed the application will crash on exit and in unmanaged code. The error message is not very useful and just says that an incorrect memory location was accessed. No other info such a specific DLL etc. is provided.
This only happens after the viewer is used to export a report to CSV, XML etc. My guess is that at some point in the export process Crystal creates a resource that attempts an action on shut down to a parent window (perhaps) that no longer exists.
I've seen a number of memory leak and shut down issues with Crystal but this one's new. Has anyone seen it and come up with a workaround or has ideas for workarounds?
So far we've tried explicitly disposing of all crystal-related objects, setting to null and even setting a Thread.Sleep cycle on shut down to "give Crystal time to clean up."
Update:
The crash happens only on shut down (so not immediate)
All export formats work
All export files are created properly
CR is installed on the same machine as the hosting .NET app
not sure about exporting from the IDE... is that even possible?
Check your code to ensure that you only open the Crystal Application object once during the lifecycle of your application. This will prevent excessive memory usage, usage that may be causing your crashes. Obviously, you can open and close reports at will.