The Way to Incorporate RadControls for ASP.NET AJAX at a WebFarm or WebGarden scenario
Recently we’ve been getting a lot of questions about the best way best to incorporate Telerik’s ASP.NET controls in a Load Balanced Environment. We have opted to shed some light onto the topic in this post. More and more web developers decide to distribute workload across multiple computers, community connections, or other tools, because this is among the most effective strategies to avoid overload, minimize the response time and at the same time achieve optimum resource utilization and maximize network throughput. Brace yourself for a short journey through the internet backend ecosystem asp net hosting uk.
WebGarden is the scenario in which a single physical machine is employed for several worker processes running simultaneously. Each worker process is responsible for managing all sorts of requests, responses, session information, cache information, etc. and all the ASP.NET functionality inside IIS runs under the scope of the worker process. By default, a single worker procedure is contained by each application pool. A WebSite containing multiple worker processes is known as a WebGarden.
Put simply — if you increase the amount of worker processes for a given ApplicationPool you receive a WebGarden.
Web Farm is called a hosting environment comprising multiple web servers. All servers within this design are connected through a virtual IP supporting a Load Balancer, which routes the incoming requests. Every time a customer request is received, it will go through the Load Balancer (LB) and then, depending on the load of each server, the LB will distribute the request to the corresponding machine. To be able to share the Session data and one, all servers should be configured to utilize identical machine key.
What is a Machine essential and how to configure it now
In standard applications it’s configured automatically and it’s different for every single Web Application.
At a Web Farm configuration, however, to get your website running properly on all the machines you have to manually create specific values for validation and decryption keys and also you need to use those values on all computers in the Web Farm (i.e. configure the in all web.config files with the same values).
The most important reason for using one and the same machine key is that the inconsistency in the Session State — that the Session depends a whole lot on the device essential to keep all the needed data in the Session State. Only his own Session data will be accessed by every server, if you keep the keys together with the generated worth and this will lead to discrepancies between the loaded resources. When a reason is to utilize machine secrets, a customized implementation of session state ought to be provided.
You could see bellow how the Telerik’s ASP.NET Image Editor might look if the machine key is not set manually, making the controller unable to load its sources properly:
Open IIS Manager in one of the servers and navigate to the Web Application you would like to manage to create its Machine Key. In Features View Machine Key:
On the Machine Key page, in order to generate specific validation and decryption key values for a Web Farm, You Need to clear”Generate a unique key for every application” for both validation and decryption keys as well as to clear”Automatically generate at run time”:
Click Create Keys from the Actions pane to make specific key values:generate-machine-key-3
The keys that are generated will be shown from the center pane:
As Soon as You have created the MachineKey, It’ll Be added automatically to the application’s web.config file:
All you need to do after that is to copy the above generated machine key and add it into the web.config files of this application in all of your servers.
Integrating RadControls in WebFarm/WebGarden
Finally — we get to the main purpose of the article:–RRB- There are some configurations That Have to be made in order to create RadControls work properly in a Load Balanced Environment: Default the image stored in the Cache. If more than one server (worker procedure ) is used to sponsor the page, the pictures should be taken from the Session because it’s shared among all the machines/applications. For instance:
The HttpHandler and Handler definitions to your Telerik.Web.UI.WebResource (from the web.config file) should be modified manually by setting the kind of the HttpHandler to be equivalent to kind =”Telerik.Web.UI.WebResourceSession”:
I will say this once more, since it’s vital – if the program is running in a WebFarm, the machine key in the web.config file of servers must be one and the same (configured manually in one of the software ), e.g:
Access the same resources from all servers / applications — if the shared or database files are altered only in one location you may have issues afterwards, so they need to be shared among all apps/machines. This is valid even in the event that you don’t possess one RadControl around. This is carried out by using a frequent database (e.g. for grids) or a custom content provider for controllers such as FileExplorer, so they don’t try to utilize local resources that will not be synced, but the typical ones.
In the conclusion if our brief journey we know much more of the surrounding web ecosystem. You should take advantage of it and provide your clients the very best possible experience.