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
Related
I'm confused on how the postback works in website and web application because,
I have a button and in that I have given a sleep time for about 30 seconds and in another page on the same time when I try to do any activities like, click redirect etc.
In Web application the above scenario works without any issue.
In Web Site till the button event comes out the sleep time all the other activities will be hang up.
Please explain me on this.
Thanks in advance.
If Session state is enabled, requests within the session will be processed one by one. In your case, request is not completed until button handler comes out of sleep. Other requests are waiting until first request is completed.
To enable concurrent requests you must specify EnableSessionState="ReadOnly" in ASPX file which contains button. Or just disable Session state in webconfig.
<%# Page EnableSessionState="ReadOnly" MasterPageFile="..." CodeBehind="xxx.cs" Inherits="xxx" %>
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.
I have a weird problem. Can't explain this inconsistent behavior.
Normally I would expect that the first GET request to load my default.aspx to fire the Session_OnStart() event. However, this happens only on the first page load after restarting the IIS. On all subsequent page loads (after clearing cookies), Session_OnStart() does not fire on the first GET request.
The page also makes two other POST requests from the client side through jQuery Ajax. Session_OnStart() does fire for BOTH of these requests on all subsequent page loads (again after clearing cookies).
This is a problem because SessionId is not being set on the first response, rather its being set twice on the subsequent responses to the POST requests. So the application ends up creating two SessionIds for each user. And again this does not happen on the first page load right after the IIS restart, which is the weird part.
it is an asp.net 3.5 website running on IIS 7.
One user of a website that I support receives the following error whenever performing a particular web based task:
System.Web.HttpException: Validation of viewstate MAC failed
This error only ever occurs for a single user browsing from an IE7 Browser.
I have crossed off the following usual suspects:
The web-server is not a part of a web farm
I have added code to ensure that the ViewState from being rendered at the beginning of the form to prevent the problem where the user performs a second post the Validate ViewState tag is rendered.
This form contains a drop-down box where the contents are modified client side via JavaScript. Could this cause the error for a particular user?
Is it possible that the there is something malicious running on the client side for that PC that is playing with the ViewState?
This problem was caused by the ViewState being validated incorrectly due to its size. The problem was resolved by implementing the "ViewState Chunking" technique to break the ViewState into many smaller pieces thereby allowing validation to be completed correctly.
This technique is described here.
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.