I've perused the forums for a couple weeks now trying out different solutions, but nothing seems to be helping. Here's my problem:
I have created an ASP.NET Web Application for displaying dashboard-style metrics in a Service Desk setting. The client has large screens in the service desk room that display specific pages of my web app.
Some pages use UpdatePanel, others use $.ajax to make calls to code behind every 15 seconds (I have various [WebMethod]'s set up for the ajax calls).
These dashboards work fantastic for about a day, maybe 2, then they stop refreshing, and the above error message can be found in the console. Bug checking for the ajax methods show they hit the 'error:' portion of the ajax call.
Below are solutions I have tried to no avail:
Added EnableSessionState="False" to the <%# Page %> header.
Added validateRequest="false" to the <%# Page %> header.
Added enableEventValidation="false" to the <%# Page %> header.
Added try-catch statements to my web methods to catch the error.
Added Global.asax and overrode the Application_Error. Made it write to an application event log. Example below.
Exception exc = Server.GetLastError().GetBaseException();
if (!EventLog.SourceExists("Dashboards"))
{
EventLog.CreateEventSource("Dashboards", "Dashboard");
}
EventLog log = new EventLog();
log.Source = "Dashboards";
log.WriteEntry(exc.ToString());
Server.ClearError();
This Global.asax exception is never called (as far as I can tell) and I never have any exceptions logged.
I can't think of any other troubleshooting to do with this.
If I had to guess, I would say it's the every 15 second ajax/updatepanel calls that is causing the issue. The app is running on IIS v8 on Server 2012. Perhaps IIS thinks it's getting DDOS'd or something similar? Another possibility is that I have various threads running in the code behind (aspx.cs) updating information that the ajax call then pulls from. Maybe the thread is getting killed somehow?
I am currently out of ideas. Any help with troubleshooting would be appreciated. I'm more than happy to upload more code as example as well.
Thank you to anyone who can assist with this.
I managed to solve this issue after extensive research.
These web pages are naturally long-running (they are dashboards that are displayed and updated continuously in a service desk environment) and they have various long-running threads that perform operations in the background.
IIS has functionality to recycle application pools, and by default the interval is set to 29 hours, which coincidentally was the interval of the internal server errors.
Since this is the only application running on this server, and there are a select few computers that will be accessing this website, I disabled the application pool recycle. This immediately fixed the problem.
I will be checking the server on a regular basis to make sure this change does not cause any other adverse issues, but so far so good.
Hopefully this helps anyone else having this issue with long running web applications.
Related
I have just released one of my application to production environment. Live environment has two IIS Servers via a Load Balance. The server configuration people has informed that they have implemented something called "Sticky Load Balancing" to carry out the sessions to IIS 1 or 2 via the Load Balance [Sessions are handled via the Load Balance].
Error
On accessing the website via IE9, I am getting a view state error. Screen Shot attached.
Exception
The exception is not being generated from Chrome Browser. But compliance requires us to tweak the application to IE9 only.
What Needs to be done to resolve the issue ?
The below post, although the person who asked it is not exactly facing the same situation, The solution which has been posted is valid for this, Especially the second point which says about defining a machine key for the application.
Please refer the below, i hope it helps.
Avoiding invalid viewstate when deploying on a load balanced website without downtime
I have an old ASP.NET intranet application where the forms login page is demonstrating unusual behavior. If any version of IE has a cleared history (history, not cookies) when they submit to log in the page executes a blank post back and remains on the login page.
If they refresh the page or had been redirected to the login page from trying to directly access another page then they are logged in without trouble.
I have published additional copies of this application to the same IIS server and they initially did not exhibit this behavior however after some number of hours they began acting the same way. Republishing to the same instance does not "fix" the issue like publishing to a new site does and neither does removing the old application and then publishing to the same name.
I'm not sure where to go from here so any help would be appreciated.
To me these are the key observations I have made:
This only effects our production server. The same code published to two other servers do not exhibit this defect. This code has worked for years until recently.
I replaced the button click code with a Response.Redirect to Google. When the button is not behaving correctly this redirect was not being fired. This indicates to me that the button code is not being executed. After the page is reloaded/refreshed it redirects properly since the button code is now firing.
When the same code is published to this IIS server under a different name it does not exhibit this defect for a number of hours. What could happen after a few hours to cause this behavioral change? Republishing to the same IIS site does not fix the issue for a few hours like publishing to a new IIS site does.
I have removed the button code from this posting because it is in my opinion a red herring as the code doesn't appear to be being executed at all.
This is what the cookies looked like in the network tools when the site is working
The difference here from when the site is working to when it is not working is that the Form1 key is marked as Sent and not Received.
Something new I have also noticed is that when the site is not working the favicon shows as (aborted). I now believe that the request is being completely aborted because I have overriden the page's OnInit and the code I entered is not being executed when the site is not working.
Today my work opened a ticket with Microsoft to help get this problem resolved and they have said it was a "head scratcher."
I disagree with Nick's thought that there is a problem in the code because of your assertion:
This only effects our production server. The same code published to two other servers do not exhibit this defect. This code has worked for years until recently.
This suggests there is a difference between servers, the way they are configured or the code is deployed that is stopping it from working. As it is a forms authentication problem, I am reminded of the bug that screwed up forms authentication in IE10 - see IE10 User-Agent causes ASP.Net to not send back Set-Cookie (IE10 not setting cookies)
Are your servers identical? Running the same OS, .NET versions, patches, hotfixes etc?
Microsoft saved the day.
They told us that the older versions of IE will look for the favicon in the root folder in IIS and not the application path regardless of where you're pointing it to look. There we found that the root folder's authentication settings were set to Windows Authentication only. For whatever reason this was causing the forms authentication to be aborted until we added Allow Anonymous to the root folder.
I am getting the following error when the user tries to submit a form, it only happens sometimes... Not sure how to resolve or what the root cause could be. Any help is appreciated. Please see below for screenshot..
Framework 4.0, IIS7
http://s12.postimage.org/69txogmwr/Untitled.png
Things that I have seen cause this:
machinekeys out of sync in a webfarm
page loads slow and the user posts back before it's finished
page sits idle after partial postbacks and the app pool is recycled
page sits idle, new code is deployed for page/controls, first postback dies due to mismatched controls
I am noticing session timeouts on my asp.net mvc web app randomly without browser being incative for for more than few minutes.
My understanding is the default timeout should be 20mins. But sometimes I get a timeout in couple minutes or even less than that. For example after browsing on the site for a while I might get a session timeout when i refresh a page very soon after I enter the page.
This is very random but I have seen this happen quite a few times now and I am not sure how I can trace this to see why I loose sessions every once in a while whithout browser being inactive long.
I checked my web.config an no timeout value is defined there so I assume it should be 20mins.
Hard to debug as this does not occur regularly..
There's an IIS setting for timeout. check it also
Maybe your application calls session abandon?
You can register session end handler to write to log on the server, to see exactly when this happens.
IIS overrides your web.config.
Go into IIS (this is for IIS 6)
Right click your website, properties, asp.net tab.
Click Edit Configurtation button on bottom, ASP.Net Configuration Settings, State Management, set your timeout here.
Are you creating any files in the bin folder, that can also cause the application to restart.
There are a number of other causes too, try googling .....
causes for asp.net web application to restart
I got a couple of hits that list the possible causes.
Our client recently complains that when they work on our production server, the user menu switch randomly, but this happens only occasionally .
The application has two types of user menu: regular user and restricted user. The target browser is IE. It's a ASP.NET3.5 application written in C#.
We can never reproduce this issue in our local environment. So it is very difficult to debug it.
Anybody met this type of issue or any clue how to debug it?
Web App Logging
Have you looked into adding a variable to your web.config to have your application perfrom less or more logging. I've done this in the past to track down bugs.
Client-side Logging
Perhaps not the intended use, but http://www.clicktale.com/ provides a javascript site analytics tools that can record all user mouse/keyboard activity that you could correlate to the web app logs. However it cost $$$.
Log Messages. Log them all over that has anything to do with the menu. Then the next time the user reports seeing it look at the log message.
Does the production environment use any load balancing s/w? Perhaps there is a problem with some session scope variables.