When page content updates are not synced between the web servers in the web farm, this may mean that web farm cache synchronization has been failing.
- Access to a SuperUser account.
- Access to the DNN file structure and IIS configuration.
- There is a provider called WebRequestCachingProvider. This provider synchronizes the cache between the enabled web servers automatically. This provider sends a request called SynchronizeCache.aspx, which is generated by a DNN handler.
- When there is more than one server in the server list, a web farm flag is enabled and the SynchronizeCache.aspx request is then sent to the servers on the list. The request reaches the uniquely defined server URLs in the list to synchronize the cache between the servers.
- Every time the request returns a 200 message, this means that the SynchronizeCache request was successful and the cache has been synced between the webheads.
Web Farm cache synchronization issues occur when any of the points above have failed to complete.
You can also confirm you are having cache synchronization issues by going into the SiteRoot/Portals/_default/Logs folder and seeing the following error:
Synchronization Error in Request:
[Thread:55][ERROR] DotNetNuke.Services.Exceptions.Exceptions - System.Exception: Synchronization Error in Request: http://www.website.com/SynchronizeCache.aspx?message=1yDD6Y0tSOM%3d&data=bYPl_hRFaUFi3RPdZCZLRy608cAwf-HVD2nEq5COLZ8%3d ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 0.0.0.0.0.
at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult)
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at DotNetNuke.Professional.Providers.CachingProviders.WebRequestCachingProvider.WebRequestCachingProvider.OnSynchronizeResponseCallback(IAsyncResult asynchronousResult)
InnerMessage: The remote server returned an error: (404) Not Found.
Another error you may encounter is:
Message: Synchronization Error in Request
InnerMessage: The underlying connection was closed: An unexpected error occurred on a send.
InnerStackTrace: at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at DotNetNuke.Professional.Providers.CachingProviders.WebRequestCachingProvider.WebRequestCachingProvider.OnSynchronizeResponseCallback(IAsyncResult asynchronousResult)
There are two solutions to this problem:
Solution #1: Synchronization Errors caused by server connectivity
From the error message, it is obvious that the connection failed because it could not connect to the host. This error may be caused by one or more of the following reasons:
- There are old/unused servers in the server list.
- You need to delete the old servers or run the
TRUNCATE TABLE webserversquery through Settings > SQL Console.
- Recycle the application pool. This will clear out the webservers list. By recycling the application pool, the application will regenerate the Web Server entries. Alternatively, you can enable the webserver monitor scheduled tasks to perform the same process.
- You need to delete the old servers or run the
- The server's unique URLs are not present in the Portal Alias table.
- You will need to add the server's unique URLs to the list of Portal Aliases.
- The Unique URLs defined for the webheads are not accessible from the webhead that sends the SynchronizeCache request.
- This can be verified by accessing each web server remotely (use the server's unique URL).
- From the remote server, make a request to other servers (use the server's unique URL, not the URL of the load balancer).
- If any errors are returned, you will need to check the connection between the webheads. You can also verify this by checking the IIS logs for the corresponding webhead (find the SynchronizeCache request and make sure it returns a 200 message).
- Make sure you set the webserver URLs to their unique FQDNs.
Solution #2: WebRequestCachingProvider Is Not Being Used
Caching issues might be caused by the fact that WebRequestCachingProvider is not being used. Hence, you will need to make sure that it is being used:
- From Persona Bar, navigate to Settings > Servers > Server Settings > Web Servers.
- From the Server Web Request Adapter drop-down, select DotNetNuke.Entities.Host.ServerWebRequestAdapter.
- Click Save.
To test that the cache synchronization has been resolved:
- Make a content update on any modules and publish the page on one web server.
- Go to Settings > Servers > Clear Cache.
- Go to another web server in the web farm by using its unique URL.
You should see that the content is consistent between the servers.