Saturday, August 27, 2016

Set Machine Key in Sitecore CD Server’s



Are you using multiple CD Servers architecture (Sitecore Web Farm)? Have you checked the machine key across the CD servers?

Are you using any below functionality in your solution?
  • __VIEWSTATE
  • forms authentication tickets,
  • MVCs anti-forgery tokens,
  • and other services which use machine key
  • any encryption/decryption using machine key


All the above functionality is machine key dependent.

And if your machine key is not sync across the multiple CD servers, then you might face some below problem.
  • Sometimes login failed (during password encryption/decryption)
  • Server Error in '/' Application.Validation of viewstate MAC failed. If this application is hosted by a web farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 

These error still coming after enabled the affinity in the load balancer

Load balancer- sticky session (affinity) helps to ensure that any given client only interacts with one physical server behind the load balancer so that all cryptographic payloads will be both generated by and consumed by the same server.

But sometimes most load balancers will redirect the client to a different physical server if the original server to which the load balancers were affinitized goes offline. This causes the new server to reject cryptographic payloads. That the client currently has.

We faced the same issue "Validation of viewstate MAC failed error" in log file. 
and also faced some cryptography error because  we used some machine key depended algorithms in the project.

NOTE: we used sticky session in load balancer, but one of our server went down frequently and we didn't set the machine key in the web config. so this is the root cause of all problems 

Solution: Sync the machine key across the CD servers:

Generate <machineKey> element for separate web config application:
By using IIS
  • Open your IIS Manager from Administrative tool -> Internet Information Services Manager.
  • In Connection pane on left side of window, click on the website.










Place these key in webconfig for each CD server application



<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.web> 
        <machineKey decryptionKey="F6722806843145965513817CEBDECBB1F94808E4A6C0B2F2,IsolateApps" validationKey="C551753B0325187D1759B4FB055B44F7C5077B016C02AF674E8DE69351B69FEFD045A267308AA2DAB81B69919402D7886A6E986473EEEC9556A9003357F5ED45,IsolateApps" /> 
    </system.web> 
</configuration>


Sitecore Always Recommended to keep the same machine key in web config across the multiple CD servers environment 

I hope this article will help you!!

Happy Sitecore :)





Monday, August 22, 2016

Sitecore Developer Tool - Google Chrome plugin




Have you ever checked Sitecore Developer tool in chrome? Yes sitecore developer tool is available in chrome browser and very useful to explore some quick navigation like admin page, databases, different mode of the page etc.

This plugin contains below section:

Favorites:
It contains the Favorites item list by default Home page,Desktop,Content Editor,page editor pages are included in the list, but we can add more pages through option configuration.




Admin Pages:
Below is the list of admin page that we can quickly switch through browser  Cache - the /sitecore/admin/cache.aspx page displays details about the caching settings configured.

  • Database Browser - the /sitecore/admin/dbbrowser.aspx page displays a view of the Sitecore database.
  • Serialization - the /sitecore/admin/serialization.aspx page provides an interface to serialize database content into XML.
  • Show Config - the /sitecore/admin/showconfig.aspx page shows the final rendered version of the web.config
  • Unlock Admin - the /sitecore/admin/unlock_admin.aspx page is useful to unlock a locked admin login.


Also we can add more admin page as below:



Database:
Database tab contains core, master, web by default and the same we can add additional database through option tab:


Mode:
Mode tab contains edit, normal, preview



And the last and important is option page; basically this is the configuration tab where we can modify/add/delete the existing settings:


Below is the link of extension:


I hope it will help you in any way.

Happy Sitecoring :)