简体   繁体   中英

IIS Machine Key Configuration

I have a .Net Framework 4.5 Web Form application that was recently deployed to our web server. Everything works fine on my local development environment. When run from the server, under IIS (7.5), I receive the following error on any postback:

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

This is a very simple application built off of the default web form template for .net framework 4.5. There is no web farm. The site is intended to run on an intranet so security isn't a huge concern.

Two questions: 1) I've found several solutions, but the most likely is to add the machine key to my web.config file manually (received a key from web generation site). This doesn't seem to fix the issue. Are there any issues with the 4.5 framework?

2) Adding the machine key via the IIS client gives me the following error: "Cannot write configuration file". I've granted full permissions to the website folder and ensured that all files are not read only. What could be the cause of this issue?

Feedback is greatly appreciated! Many hours have been wasted.

Turned out to be a permissions issue in the website folder. The folder resided on a SAN. A local folder works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM