Problem

Lately we uploaded a new Sitecore site on two load-balanced servers on the Microsoft Azure platform with IIS 8. We faced a problem with pages utilizing the ASP .Net Ajax update panel mechanism. The problem was that, on pages containing an update panel, the auto-generated Microsoft ScriptResource.axd and WebResource.axd files could not be loaded, failing with a 404 error.

The behavior was strange since the problem did not occur always. With every page refresh, either three files failed to load with 404, or none, or two of them, etc. With every page load the number of files not found was variable.

Azure Load Balancer Error

Since we were on the Azure platform we searched the internet for "Ajax asp.net not working on Azure" and "Sys is not defined on Azure", etc and came across a number of possible solutions including adding handlers to the web.config file, installing the ASP.Net Control Toolkit, changing the AppPool mode from Integrated to Classic, etc. None of these worked for us and I believe that none are valid for the IIS 8 platform.

We soon realized that, when removing one of the two VMs from the Load Balancer the problem disappeared. So it was clearly a problem with the way the requests were distributed across the several nodes. It seemed as if some of the HTTP requests of a single page being loaded were sent to one of the nodes, the dynamic .axd files were created on this node and then the rest of the HTTP requests were routed to the other node, where the dynamic files were not created, causing a 404 error.

Solution

The solution proved to be very simple. All you have to do is to make sure that all the nodes of the load balanced set have the same machine key in their web.config.

eg:

<system.web>

<machineKey decryptionKey="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,IsolateApps" validationKey="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx,IsolateApps" />

</system.web>

The exact same value has to exist in all the web.configs of all nodes of the set.

Simple!