Microsoft KB Archive/815162

From BetaArchive Wiki

Article ID: 815162

Article Last Modified on 4/30/2003



APPLIES TO

  • Microsoft ASP.NET 1.0
  • Microsoft ASP.NET 1.1



SUMMARY

This step-by-step article discusses how to set up multi-server ASP.NET Web Applications and Web services. For most uses of ASP.NET, a single server can handle all requests in a timely manner. However, many environments must deploy multiple servers to handle consistently high volumes of traffic, to support processor-intensive applications, to respond to sudden bursts in traffic, or to meet redundancy requirements.

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.

back to the top

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


back to the top

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 deploy configuration information and ASP.NET content to multiple servers, it is critical to deploy the content from a single staging server to all production servers at the same time. This reduces the chance of problems occurring when a user’s requests are sent to different servers. Microsoft recommends that all configuration and content updates occur on the staging server. Ideally, this staging server does not receive requests from users. It is dedicated to the task of testing and deploying new content.

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.

back to the top

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.

back to the top

REFERENCES

For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

315736 HOW TO: Secure an ASP.NET Application by Using Windows Security


315588 HOW TO: Secure an ASP.NET Application Using Client-Side Certificates


818015 HOW TO: Tune and Scale Performance of Applications That Are Built on the .NET Framework




back to the top

Keywords: kbhowtomaster kbperformance kbwebserver kbconfig kbwebservices kbscalability KB815162