Web Farm and Web Garden Support
- 5 minutes to read
This topic describes how to implement file upload functionality in a clustered web environment (also known as a Web Farm or a Web Garden).
A Web Farm hosts a web application on multiple web servers, whereas a Web Garden runs an application on the same server - but in different worker processes. In a Web Garden, each worker process is executed on its own processor - specified by the Internet Information Services (IIS) settings of the server host where the application is deployed.
To implement file upload on a Web Farm or a Web Garden, customize the following settings.
Website Settings
The machineKey element in the web.config file should have the same settings for all websites in a Web Farm or Web Garden. Refer to the following Microsoft article for more information: How To: Configure MachineKey in ASP.NET 2.0.
Web Control Settings
If an instance of a website on a Web Farm/Web Garden uses an individual file system, utilize the following options to specify the file system parts that are shared for all website instances in the clustered web environment.
Settings to configure a temporary folder to store uploaded files.
- ASPxUploadControl
When the UploadMode property value is set to
Advanced
orAuto
, and the UploadStorage property value is set toNotSet
orFileSystem
, use the ASPxUploadControl.AdvancedModeSettings.TemporaryFolder property.The following code snippets illustrate how to specify the TemporaryFolder property.
ASPxUploadControl.AdvancedModeSettings.TemporaryFolder = "//folder1" //The "y" drive refers to a network folder. ASPxUploadControl.AdvancedModeSettings.TemporaryFolder = "y:\folder"
- ASPxFileManager
When the FileManagerSettingsUpload.UseAdvancedUploadMode property is set to
true
, use the ASPxFileManager.SettingsUpload.AdvancedModeSettings.TemporaryFolder property.Note
Auto-generated thumbnails are stored in the ThumbnailFolder folder. You should specify a path that can be accessed by all servers because if some servers in your environment cannot access this folder, thumbnails are not displayed. If this is not possible, you can handle the CustomThumbnail event or implement a custom file system provider and override the GetThumbnailUrl(FileManagerFile) method to provide custom thumbnails.
- ASPxHtmlEditor
When the ASPxHtmlEditorUploadSettingsBase.UseAdvancedUploadMode property of a specific selector is set to
true
, use the following properties:- ASPxHtmlEditor.SettingsDialogs.InsertLinkDialog.SettingsDocumentSelector.UploadSettings.AdvancedModeSettings.TemporaryFolder
- ASPxHtmlEditor.SettingsDialogs.InsertImageDialog.SettingsImageSelector.UploadSettings.AdvancedModeSettings.TemporaryFolder
- ASPxHtmlEditor.SettingsDialogs.InsertAudioDialog.SettingsAudioSelector.UploadSettings.AdvancedModeSettings.TemporaryFolder
- ASPxHtmlEditor.SettingsDialogs.InsertVideoDialog.SettingsVideoSelector.UploadSettings.AdvancedModeSettings.TemporaryFolder
- ASPxHtmlEditor.SettingsDialogs.InsertFlashDialog.SettingsFlashSelector.UploadSettings.AdvancedModeSettings.TemporaryFolder
When the ASPxHtmlEditorUploadSettingsBase.UseAdvancedUploadMode property of a specific dialog is set to
true
, use the following properties:- ASPxHtmlEditor.SettingsDialogs.InsertImageDialog.SettingsImageUpload.AdvancedUploadModeTemporaryFolder
- ASPxHtmlEditor.SettingsDialogs.InsertImageDialog.SettingsImageUpload.AdvancedModeTemporaryFolder
- ASPxHtmlEditor.SettingsDialogs.InsertAudioDialog.SettingsAudioUpload.AdvancedModeTemporaryFolder
- ASPxHtmlEditor.SettingsDialogs.InsertVideoDialog.SettingsVideoUpload.AdvancedModeTemporaryFolder
- ASPxHtmlEditor.SettingsDialogs.InsertFlashDialog.SettingsFlashUpload.AdvancedModeTemporaryFolder
- ASPxSpreadsheet
- When the ASPxHtmlEditorUploadSettingsBase.UseAdvancedUploadMode property is set to
true
, use the ASPxSpreadsheet.SettingsDocumentSelector.UploadSettings.AdvancedModeSettings.TemporaryFolder property. - ASPxRichEdit
- When the ASPxHtmlEditorUploadSettingsBase.UseAdvancedUploadMode property is set to
true
, use the ASPxRichEdit.SettingsDocumentSelector.UploadSettings.AdvancedModeSettings.TemporaryFolder property. - ASPxBinaryImage
- When the BinaryImageUploadSettings.UploadMode property is set to
Auto
, use the ASPxBinaryImage.EditingSettings.UploadSettings.TemporaryFolder property.
Settings to configure the folder that is used to store files after upload.
- ASPxUploadControl
- When the UploadStorage property is set to
FileSystem
, use the UploadFolder property. - ASPxHtmlEditor
When the UploadStorage property is set to
FileSystem
, use the following properties:- ASPxHtmlEditor.SettingsDialogs.InsertImageDialog.SettingsImageUpload.FileSystemSettings.UploadFolder
- ASPxHtmlEditor.SettingsDialogs.InsertAudioDialog.SettingsAudioUpload.FileSystemSettings.UploadFolder
- ASPxHtmlEditor.SettingsDialogs.InsertVideoDialog.SettingsVideoUpload.FileSystemSettings.UploadFolder
- ASPxHtmlEditor.SettingsDialogs.InsertFlashDialog.SettingsFlashUpload.FileSystemSettings.UploadFolder
Binary Storage Configuration
This section describes how DevExpress ASPxCapcha, WebChartControl, ASPxGauges and ASPxBinaryImage controls support the IIS clustered web environment (also known as a Web Farm or a Web Garden).
A Web Farm hosts a web application on multiple web servers, whereas a Web Garden runs an application on the same server - but in different worker processes. In a Web Garden, each worker process is executed on its own processor - specified by the Internet Information Services (IIS) settings of the server host where the application is deployed.
A Web Garden specifies multiple worker processes for an application pool that yields the following advantages.
- Robust request processing: when a worker process in an application pool is busy (e.g., when a script engine stops responding), other worker processes can accept and process requests for the application pool.
- Reduced resource competition: when a Web Garden reaches a steady state, each new TCP/IP connection is assigned to a worker process (within the Web Garden) based on a round-robin load distribution. This balances workloads and reduces competition for resources that are bound to a worker process.
Under default settings, a binary storage mechanism does not work with Web Farms or Web Gardens for enhanced binary image transformation from a specified binary storage to the client.
To utilize Web Farms and Web Gardens, use the control’s BinaryStorageMode property (ASPxBinaryImage.BinaryStorageMode, ASPxGaugeControl.BinaryStorageMode, CaptchaImageProperties.BinaryStorageMode, WebChartControl.BinaryStorageMode), the BinaryStorageConfigurator.Mode field, and BinaryStorageConfigurator.RegisterCustomStorageStrategy and BinaryStorageConfigurator.RegisterStorageStrategy methods to modify binary storage settings.
The BinaryStorageMode property provides the following modes.
Value | Description |
---|---|
Default | Uses the Cache mode if a configuration is not defined by the BinaryStorageConfigurator.Mode field. |
Session | Stores binary data within a session. Web Gardens and Web Farms can be used by the binary storage mechanism if an application session is configured with the SQL Server or State Server Session-State Mode. |
Cache | Binary data is stored within a cache. Web Gardens and Web Farms will not work correctly in this mode. |
Custom | Custom mode provides for implementing a custom scenario for storing and accessing binary data. Web Farms and Web Gardens should work if the custom configuration implements storing the binary data on the hard drive, or by using a web service. |
Note
To specify the binary storage mode for DevExpress ASPxCapcha, ASPxCharts, ASPxGauges and ASPxBinaryImage controls simultaneously, define the BinaryStorageMode property within the global.asax file as shown below:
void Application_Start(object sender, EventArgs e) { DevExpress.Web.BinaryStorageConfigurator.Mode = DevExpress.Web.BinaryStorageMode.Session; }