The Way to integrate RadControls for ASP.NET AJAX at a WebGarden or WebFarm scenario
Lately we’ve been getting a lot of questions on the best way best to integrate Telerik’s ASP.NET controllers in a Load Balanced Environment. Thus, we have opted to shed some light onto the topic in this blog post. More and more web developers decide to distribute workload across multiple computers, network links, or other tools, since this is one of the most efficient strategies to prevent overload, minimize the reaction time and in precisely the exact same time achieve optimum resource utilization and maximize network throughput. Brace yourself for a brief journey through the web backend ecosystem.
What is a WebGarden
WebGarden is the scenario in which one physical machine is employed for several worker processes running simultaneously. Each worker process is responsible for managing all kinds of requests, answers, session information, cache information, etc. and each of the ASP.NET operation inside IIS runs under the range of the worker process. By default, one worker procedure is contained by each program pool. A WebSite containing multiple worker processes is called a WebGarden.
Put only — if you raise the amount of worker processes for a given ApplicationPool you get a WebGarden asp net hosting uk.
What’s a WebFarm
WebFarm is called a hosting environment consisting of multiple servers. All servers in this design are connected via a virtual IP supporting a Load Balancer, which routes the requests to the servers within the WebFarm. Every time a client request is received, it is going to go through the Load Balancer (LB) and then, depending on the load of each server, the LB will distribute the petition to the corresponding server. In order to share the exact same Session data, all servers should be configured to utilize machine key.
In standard applications it is configured automatically and it’s different for every single WebApplication.
In a WebFarm setup, however, to get your website running properly on most of the machines you have to manually generate certain values for validation and decryption keys and also you must utilize those values on all computers in the WebFarm (i.e. configure the inside all web.config files with exactly the very same values).
The main reason for using one and the exact same machine key is the inconsistency in the SessionState — the Session depends a lot on the machine essential to maintain all of the needed information in the SessionState. Just his own Session data will be accessed by every server Should you keep the keys with the mechanically generated worth and this will lead to discrepancies between the resources. If a reason is to use different machine keys, a customized implementation of session state should be provided.
You could see bellow the way the Telerik’s ASP.NET ImageEditor may look if the machine key is not set manually, which makes the controller unable to load its resources properly:
Open IIS Manager in one of the servers and browse to the WebApplication you want to manage to create its Machine Crucial. In Characteristics View, double-click Machine Key:
About the Machine Key page, so as to Create special validation and decryption key values to get a WebFarm, You Need to clear”Generate a Exceptional key for each program” for both validation and decryption keys and to transparent”Automatically generate at runtime”:
Click Generate Keys from the Actions pane to create specific Important values:generate-machine-key-3
The keys that are generated will be shown from the center pane:
All you need to do after that is to replicate the above generated device key and insert it to the web.config files of the application in each one your servers.
Finally — we get to the main purpose of the post:–RRB- There are some configurations which have to be made so as to create RadControls function correctly in a Load Balanced Environment:
ImageStorageLocation — when the used control supports this land (e.g. Telerik’s ASP.NET Captcha, ImageEditor, etc.) it needs to be set to”Session”. Default the image saved in the Cache. If more than 1 server (worker process) is used to sponsor the webpage, the images should be taken in the Session since it’s shared among all of the machines/applications. For example:
The HttpHandler and Handler definitions for the Telerik.Web.UI.WebResource (in the web.config file) ought to be modified manually by setting the type of the HttpHandler to be equivalent to kind =”Telerik.Web.UI.WebResourceSession”:
I will say this once more, because it is vital – if the program is operating in a WebFarm, the machine key in the web.config file of all servers must be one and the same (configured manually in one of those software ), e.g:
Access the same resources from all servers / software — if the shared or database files are altered only in 1 location you may have issues later, so they need to be shared among all of apps/machines. That is valid even in the event that you don’t have one RadControl. This is done using a frequent database (e.g. for grids) or a custom made content provider for controls like FileExplorer, so that they don’t attempt to utilize local resources which won’t be synced, but the common ones.
At the conclusion if our brief journey we understand much more of the surrounding ecosystem. You provide your clients the best possible experience and should take advantage of this. Leave a comment below if this helped you begin or you’ve had an interesting case you got running!