I have recently worked with a server that was struggling with high CPU usage only at a certain time of the day: 4am. It sounds odd first but it made sense later. I will discuss the scenario and possible solutions in this post.Read More
IIS applications run on application pools. Application pools receive requests and process them based on the settings defined. One of the settings is application pool identity. This is the account that runs application pool and perform required tasks. You may come across to this error message while trying to set a custom account as application pool identity: “Value does not fall within the expected range.“
This error occurs only if you are specifying a custom account and not using any predefined accounts such as
The exact error message:
There was an error while performing this operation. Details: Value does not fall within the expected range.
You may come across this error message when you get around in pages of your ASP.NET website:
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
ASP.NET uses view-state variable to rebuild pages after post-backs. The text of your buttons and the value of the form fields are the examples that this variable stores.
In order to prevent tempering attacks that try to play around with view-state data to force your webpage behave unexpectedly, web server validates the view-state data between page redirections. If the data doesn’t match, you receive the error message above.
The issue of unmatched view-state data could be related to server configuration or session cookie. Here are the most common root causes:
- Web server and application pool configuration related issues. Read details in this Microsoft Support article
- If you are using
ViewStateUserKeyto prevent Cross-site Request Forgery (CSRF) attacks, make sure the value you assign to this variable is the same in all pages. The most common usage is that assigning session ID or username to
ViewStateUserKey. Your website might be losing the session between page redirections. Check these two StackOverflow topics for details: Link 1, link 2
- Redirecting the page right after setting session variables may be the issue. You should avoid using
Response.Redirectin this case. Details
- Antivirus software might be causing the issue. Add scanning exceptions for IIS and your application’s folders. Details