In the simplest form, you can deploy Web pages that consist only of static HTML pages and images in a multi-server configuration by copying the files to multiple Web servers and then configuring a load balancing mechanism to distribute requests between the Web servers.
As the Web site complexity increases, the difficulty of synchronizing files and configurations between the servers also increases. Dynamic sites require multiple servers to have access to a single database and to share state information among themselves. This article describes how to design multi-server ASP.NET solutions that include databases and sessions.
Manage State
As a user navigates through an ASP.NET site, ASP.NET stores information about the user's session state. The exact information that is stored in the session varies by application, but may include the user�s name, preferences, and shopping cart information.By default, ASP.NET stores session information in the server memory. This configuration is known as in process. Although this configuration provides the best performance possible, you lose the session information if you restart the ASP.NET server. Additionally, in multi-server architectures, a single user�s request can be sent to a different server. A user may start a session at one server, but later requests are sent to a different in-process server. This results in a new session being created for that user and all earlier information that was stored in the session is lost.
ASP.NET provides two solutions for sharing state information between multiple servers: the ASP.NET State Server service, and Microsoft SQL Server. You can use either of these solutions to store state information between server restarts, and to allow users to move between servers during a single session. For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
317604
HOW TO: Configure SQL Server to
Store ASP.NET Session State
815159 HOW TO: Analyze ASP.NET Web Application Performance by Using the Performance Administration Tool
Synchronize Configuration and Content
A Web site�s security, performance, and many other aspects of its behavior are defined by the configuration of the Web server. Multi-server sites must have the configuration synchronized between all the servers to provide a consistent experience to users whose requests are sent to different Web servers. ASP.NET makes it simple to synchronize configuration between multiple servers because all configuration information is stored in the virtual server�s path as XML files. These files have a .config file name extension.You can copy configuration files to servers by using any standard file copy or synchronization method, including DFS, the File Replication service, and Microsoft Application Center 2000. The following batch file will work in environments where each Web server has the virtual server root folder shared as wwwroot$:
XCOPY \\source-server\wwwroot$ \\destination-server#\wwwroot$ /D /E /O /X
When you replicate updated .config files to a Web server, that Web application automatically restarts.
Note If you put assemblies in the Global Assembly Cache, you cannot replicate them by using file synchronization.
Other Tasks
Besides configuring state management and content synchronization, you must perform the following tasks to deploy a multi-server ASP.NET solution. These tasks are not specific to ASP.NET.- Request distribution: Incoming HTTP requests must be distributed among all servers by using a mechanism such as round-robin DNS, Microsoft Application Center 2000, or a third-party load distribution device.
- Log aggregation: Before you process HTTP usage logs, it is a good idea to combine the logs to create a single log that includes requests sent to all systems.
- Monitoring: To detect problems that affect a single server or the whole site, you must monitor both the external URL for the site and the URLs for each of the Web servers.
- Centralized database: Web applications that use a database must have a single database that is shared between multiple Web servers. In environments that require no single point of failure, cluster the database server.