Bernd
Bernd

Reputation: 340

ASP.NET Web Farm with 4.0 and 4.5.1 causes Invalid postback or callback argument exceptions

I have a site that runs in a web farm behind a load balancer. I have a consistent <machineKey /> element in each of the web.config files on each of the servers. Until recently all servers ran .NET 4.0 (.NET 4.5 was not installed). This morning I introduced a new server to the farm that runs the exact same code and configuration as the existing servers, except it has .NET 4.5.1 installed.

I am using the following to target .NET 4.0 on all servers

<compilation targetFramework="4.0">

And a machineKey element like this (key values removed for security):

<system.web>
    <machineKey decryptionKey="..." validationKey="..." />
</system.web>

Does .NET 4.0 handle validation or encryption/decryption differently than .NET 4.5.1 even when the targetFramework is 4.0?

Upvotes: 2

Views: 901

Answers (1)

Levi
Levi

Reputation: 32828

Every machine in a web farm must have the exact same version of ASP.NET installed. Running 4.0 and 4.5.1 mixed in a farm is not supported.

That said, there are two ways to perform the upgrade:

  1. Take half the farm offline, upgrade the offline machines to 4.5.1, then simultaneously bring these machines back into the farm while taking the remaining half offline. Then update the remaining offline machines and bring them back in.

  2. If you absolutely need to perform an in-place upgrade, set the <appSettings> switch aspnet:UseLegacyEventValidationCompatibility to "true" in Web.config (see MSDN), then one by one upgrade your machines to 4.5.1. This is not a supported configuration but should work. It is imperative that you not keep this <appSettings> switch around for any length of time, so be sure to remove it from your Web.config once the upgrade is complete.

Upvotes: 2

Related Questions