ASP.NET MVC CrystalReportViewer - Exception with max number report processing - asp.net-mvc

We had problem with usages of CrystalReportViewer for ASP.NET MVC (webforms control from SAP). Sometimes we get this exception:
CrystalDecisions.Shared.CrystalReportsException: Report could not be loaded.
System.Runtime.InteropServices.COMException: The maximum number of report processing requests set by your system administrator has been reached.
Notes - WebForm page:
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" HasRefreshButton="True" />
In C# is only set ReportSource and then is stored to the ASP.NET MVC session.
We save in code object ReportDocument (CrystalReportViewer.ReportSource) to the ASP.NET MVC session.
After session ends we call ReportDocument.Close() and ReportDocument.Dispose().
But still are information about reports somehow in memory and user got exception with max number of reports. Only what helps is on ISS recycle application pool or set some high number in Windows registry (\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\Server\PrintJobLimit).
Do someone know how should be ReportDocument/ReportViewer properly cleared ?

Related

ASP.NET in debug mode gets random timeouts against a local SQL Server 2019 database

This problem occurs only in debug mode with my ASP.NET MVC application. In release mode, everything is ok.
In debug mode, I can pass through my login process let's say 2 out of 10 times. All I usually get is a timeout on a Linq query (EF6) applied on a 50000 rows database table. Is there any options in Visual Studio that would explain this?
It usually takes a few (long) seconds between me clicking on a button and the controller's method being called. And when I'm debugging and try to execute a linq query, I get SQL Server timeouts a lot of times.
Deleting the web site cache helps a little but something else is wrong, probably with Visual Studio itself

losing session data in asp.net

My IIS session occasionally loses all data stored in it, it usually takes about 3-5 minutes, but definately less then the session timeout set in the web.config. The problem is not reproducible reliably, when it happens, accoring to the logs the AppPool is not recycled and the Session ID remains the same, it just loses all data. Any suggestions on how to debug this?
So far I tried to overwrite the session provider and stored the session data into a static variable, we checked all relevant timeouts and we stored a dummy value in the session, that is lost as well
A number of things can cause session state to mysteriously disappear.
Your sessionState timeout has expired
You update your web.config or other file type that causes your AppDomain to recycle
Your AppPool in IIS recycles
You update your site with a lot of files, and ASP.NET proactively destroys your AppDomain to recompile and preserve memory.
If you are using IIS 7 or 7.5, here are a few things to look for:
By default, IIS sets AppPools to turn themselves off after a period of inactivity.
By default, IIS sets AppPools to recycle every 1740 minutes (obviously depending on your root configuration, but that's the default)
In IIS, check out the "Advanced Settings" of your AppPool. In there is a property called "Idle Time-out". Set that to zero or to a higher number than the default (20).
In IIS, check the "Recycling" settings of your AppPool. Here you can enable or disable your AppPool from recycling. The 2nd page of the wizard is a way to log to the Event Log each type of AppPool shut down.
If you are using IIS 6, the same settings apply (for the most part but with different ways of getting to them), however getting them to log the recycles is more of a pain. Here is a link to a way to get IIS 6 to log AppPool recycle events:

Large Pages on IIS + ASP.NET MVC

I am getting some trouble with a ASP.NET MVC + IIS 7.5 page. I have a really extensive page that sometimes exceeds 15.0MB uncompressed and 1.5MB compressed.
When it happens, it looks like connection never ends. The loading icon stays forever and if I see at Developer Tools, the connection is pending, despite the entire HTML is received.
It happens at Chrome, Firefox and Internet Explorer, so I think the problem is ASP.NET or IIS.
Do I need to do something special to handle such a pages?
15MB is going to be horribly slow and unresponsive - not something your users want - however much they want to "see all published files".
I would introduce, for example, paging into your webpage so not all the files are downloaded at once.
However, if you really want a 15MB page, you may find the limits config can help.
You say that the entire HTML was provably received. How could IIS or ASP.NET be the problem then? Once the content is sent they are out of the loop.
The browser is probably the problem.
You could try setting Response.Buffer to false.
The Buffer property indicates whether to buffer page output. When page output is buffered, the server does not send a response to the client until all of the server scripts on the current page have been processed, or until the Flush or End method is called.
By default, Response.Buffer is set to true, so output will be buffered. Perhaps by feeding the response to the client as it comes the browsers will behave as you need them to.
You do need to set the value of Response.Buffer before any output is sent to the browser though.
Maybe try IIS compression?
IIS provides the following compression options:
Static files only
Dynamic application responses only
Both static files and dynamic application responses
http://technet.microsoft.com/en-us/library/cc771003%28v=ws.10%29.aspx

My ASP.net MVC 4 site gets slow on first request to SQL Server Express 2012

I have an ASP.net MVC 4 site and it gets slow on the first request.
It is not high slow but pages that use to long 1000-700 ms on load, the first time it longs 8-15seg. It occurs when i wait for 10 minutes for example and come back to make a request. The web site is not on production server yet. May it be when the app pool does not receive any request it goes to sleep?.
I have configured the new AutoStart mode in framework 4:
http://weblogs.asp.net/scottgu/archive/2009/09/15/auto-start-asp-net-applications-vs-2010-and-net-4-0-series.aspx
I think it may be the first request to the SQL Server Express 2012 (in the same server).
I have set the autoclose=off in the database.
What more can i do?. How could i see what is going on the first request to avoid that slow response?.
Thanks to every one who has apported to this question.
Finally i think it has to do with the idle time configuration in the App pool.
It was set 5 min (default) and i have set it 60 min. and now it goes fine!
Thanks to this question:
First request is very slow after website sits idle with ASP.NET MVC 3 (IIS7)
You can compile the views for faster performance.
The documentation is for MVC 3, but it should still work:
Compile Views in Asp.Net MVC 3 with Visual Studio

Random Session Timeout in ASP.NET MVC3

i have an application which gets random session timeouts. (IIS 7.5 on Windows 2008 R2, .NET 4.0)
i tried the following:
checked the application log if the w3wp.exe process was crashed, but there is no entry.
disabled in the application pool the rapid fail protection
moved to the sql server state provider to be sure the loadbalancers sticky session is not
the problem. (we use a kemp loadmaster).
ensured that no other applications use the same application pool.
checked that exceptions in a thread of a called assembly is correctly handled. (simulated using throw new exception) and the error handling was correct.
ensured that the validationKey and decryptionKey is set in the webconfig on all 4 webservers to the same key.
i run now out of ideas how to spot this evil bug. any suggestions? i cannot reproduce the problem on my local machine in the debugger.
one point which is maybe important, the move from page 1 to page 2 where the session loss often happens, takes sometimes more than 120 seconds, because of a third party system which is connected via tcp socket.
HI Snoopy you linked to my question as they are similar,
As my appool was crashing I tried this solution. If your appool crash's this may help
http://support.microsoft.com/kb/911816
the solution stop fix hack kept my app-pool up but didn't fix the problem,
<configuration>
<runtime>
<legacyUnhandledExceptionPolicy enabled="true" />
</runtime>
If your app-pool is still intact you might try ELMAH as this helped me a lot
http://code.google.com/p/elmah/
you can use this code to get ELMAH to handle unmanaged exceptions
http://code.google.com/p/elmah/issues/detail?id=199
I am curious if it is MVC 3.0 problem with .net 4.0
as i have several very similar apps running using MVC 2.0 with no problems,
Only started when I moved to MVC 3.0
Does it happen on a single server? Sure sounds like an issue with the web-farm.
Can you alter your app so you don't use the 3rd-party app for testing?
You have to eliminate pieces until the failure goes away, then add stuff back. Restore 3rd party app, turn other servers back on, etc.

Resources