Short time ago we found the following error when running Reports randomly in a web farm:

 

Validation of view state mac failed, this application is hosted by a web farm or cluster, ensure that machine key configuration specifies the same validation key and validation algorithm

 

If you find yourself with this error, you have 2 alternatives to solve it:

 

1.       Configure the <machinekey> tag in the configuration files of the load balancer as explained in the following article:

 

Configuring a Report Server Scale-Out Deployment

http://msdn.microsoft.com/en-us/library/ms156453(SQL.90).aspx

 

Configuring View State Validation

To complete scale-out deployment, you must edit configuration files to enable view state for interactive HTML reports that are viewed in Report Manager.

In Microsoft .NET Framework 2.0, view state validation is enabled by default and uses ASP.NET process identity information to perform validation. Validation by process identity does not work in a cluster or scale-out scenario where the process identity varies for each node. As an alternative, you can generate a validation key to support view state validation and manually configure each report server node to use it.

The following steps include references to generating keys for the <machineKey> element. There are a variety of ways to generate key values, and the approaches for doing so are described in the .NET Framework documentation. For more information about configuring view state validation for a network of Web services, see the .NET Framework reference documentation for the <machineKey> element.

1.        Generate a validation key. You can use the autogenerate functionality provided by the .NET Framework or you can create the key some other way. Do not use the AutoGenerate option when setting the validationKey attribute.

2.        Generate a decryption key. For the decryption key, you can create an explicit value or set decryptionKey to AutoGenerate.

3.        Open the Web.config file for Report Manager and set the <machineKey> element. You must specify the validation key, decryption key, and the type of encryption used for validation of data. The following example illustrates the entries you must provide (these example values are not valid; avoid copying these entries into your configuration files): <machineKey validationKey="53ab8bv3ebc93bb826a7b3v37b903a9d5d4a0" decryptionKey="26165b97a9d5d4a0" validation="SHA1"/>

4.        Repeat these steps for each report server in the scale-out deployment. Verify that all Web.Config files in the \Reporting Services\Report Manager folders contain identical <machineKey> elements in the <system.web> section

You can use this tool to easily generate a Key

http://aspnetresources.com/tools/keycreator.aspx

 

 

2.       Or configure session affinity in the DNS of the load balancer: 

If you use a sticky load balancer for the web farm, the above requirement is not necessaty: when a user connects o the balancer, this makes sure that the user is redirected always to the same server during the session.  This is also called “session affinity”

 

You can find more information about the term “sticky” on "persistence" section

http://en.wikipedia.org/wiki/Load_balancing_(computing)

 

Maria Esteban

Reporting Services Support Engineer