Clustered Sample
To see this sample in action, download the SlickUpload package and configure it for your environment.
NOTE: the maximum allowed request size for this sample is 1000 MB. If you attempt to upload files larger than this,
you will recieve a oversized upload error which SlickUpload will handle gracefully. This is controlled by the maxRequestLength attribute of the
httpRuntime key in the web.config file.
Configuration
Configuration for the status manager sample involves creating the status database and table and configuring SlickUpload
to point at that database. To do this, perform the following steps:
- Create a new database, or select an existing database to use
- Open and run the UploadStatusTable.sql script in the SlickUpload distribution package root folder on the selected database
- Uncomment the statusManager section in the root web.config. This section is only valid at the root of an application.
- Change the connection string in the statusManager web.config section to point to the database selected above
Description
In clustered environments with multiple boxes or application instances, an upload may be handled by one instance with the progress requests being handled by another instance and
the final postback by yet another instance. To handle this environment, SlickUpload includes a status management architecture for centralizing the upload status information.
By default, the upload status is stored in application state (via the ApplicationStateStatusManager). SlickUpload includes a SqlClientStatusManager that stores the upload status
in a central SQL Server database, as well as the capability to extend to use a custom status manager.
This sample covers the configuration and use of the SQL Server status manager. To use this instead of the default ApplicationStateStatusManager, use a statusManager web.config
configuration section like the following:
<statusManager manager="SqlClient"
connectionString="server=.;uid=xxx;pwd=xxx;database=xxx;"
table="UploadStatus" keyField="UploadId" statusField="UploadStatus" lastUpdatedField="LastUpdated"
updateInterval="1" />
You can use other table and field names by changing them in the database and setting them in the SlickUpload configuration. This configuration is the default,
built around the provided UploadStatusTable.sql schema.
NOTE: when looking at the status table during uploads in this sample, you may see extra orphan status records. This is because the sample architecture causes
page postbacks to be handled as uploads. In a production application where uploads are directed only to the specified SlickUpload handler, orphan records won't be created.
SlickUpload also includes an abandoned upload sweeper that eliminates orphaned status records every 10 minutes.
|