We (our IT partner really) recently changed some DNS for a web farmed site we have, so that the two production server have round-robin DNS switching between them. Prior to this switch we didn’t really have problems with WebResource.axd files. Since the switch, when we hit the live public URL, we get an error:
CryptographicException
Padding is invalid and cannot be removed.
When we hit the specific servers themselves, they load fine. I’ve researched the issue and it seems since they’re sharing assets between two servers, we need to have a consistent machineKey in the web.config for each server so they can encrypt and decrypt consistently between the two. My questions are:
- Can I generate a
machineKeyvia a tool on the server, or do I need to write code to do this? - Do I just need to add the
machineKeyto theweb.configon each server or do you think I’ll need to do anything else to make the two server work together? (Bothweb.config‘s currently do not have amachineKey)
This should answer:
How To: Configure MachineKey in ASP.NET 2.0 – Web Farm Deployment Considerations
In short, to set up the machine key refer the following link:
Setting Up a Machine Key – Orchard Documentation.
and add the following line to the
web.configfile in all thewebserversundersystem.webtag if it does not exist.Please make sure that you have a permanent backup of the machine keys and
web.configfile