Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 97 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
97
Dung lượng
1,87 MB
Nội dung
Lesson 1: Confi guring Web Applications CHAPTER 13 651 MORE INFO .NET FRAMEWORK 3.0 For more information about .NET Framework 3.0, see http://msdn.microsoft.com/en-us /netframework/default.aspx. Using the Default Web Site and Adding Web Sites When you install the Web Server server role, the installation includes a site called Default Web Site that is confi gured to respond to requests, using HTTP (port 80) and HTTPS (port 443). You can view the site bindings, shown in Figure 13-2, by right-clicking Default Web Site in IIS Manager and selecting Edit Bindings. You can also use the Bindings link in the Actions pane to open the same dialog box. FIGURE 13-2 Viewing the site bindings for Default Web Site. When you launch a Web browser and connect to a simple URL that does not specify direc- tories or virtual directories, for example, http://glasgow.contoso.internal, you view the contents of Default Web Site. IIS7 receives the request on HTTP port 80 and returns the appropriate content from the Web site. You can add a new site binding for the Default Web Site by clicking the Add button in the Site Bindings dialog box. You can specify the protocol type, IP address, port information, and (optionally) hostname. If you attempt to add a site binding that is already in use, you are reminded that you must confi gure a unique binding. Adding Web Sites You can add a new Web site by right-clicking the Sites container in IIS Manager and selecting Add Web Site. Figure 13-3 shows the Add Web Site dialog box. In addition to specifying the default protocol binding for the site, you must provide the site name. This setting is a logical name that users do not see on the site. By default, IIS Manager creates a new application pool with the same name you provide for the Web site. You can also select an existing application pool by clicking the Select button. You learn more about application pools and their purpose later in this lesson. MORE INFO .NET FRAMEWORK 3.0 For more information about .NET Framework 3.0, see http://msdn.microsoft.com/en-us /netframework/default.aspx . /netframework/default.aspx./netframework/default.aspx 6 5 2 CHAPTER 13 Configuring a Web Services Infrastructure FIGURE 13-3 The Add Web Site dialog box. In the Content Directory section of the dialog box, you can specify the full physical path to the folder that is the root of the Web site. The default root location for IIS7 Web content is %SystemDrive%\Inetpub\wwwroot. The initial files for Default Web Site are located in this folder. You can create a new folder (either within this path or in another one) to store the con- tent of the new Web site. You use the Connect As button to specify the security credentials that IIS7 requires to access the content. The default setting is Pass-Through Authentication, which means that the security context of the requesting Web user is used. You learn more about securing Web site content later in this chapter. Before you click OK to accept the Web site settings, you can specify whether you want the site to be started immediately. If the Web site binding information is already in use, you are given a warning. Otherwise, the site is created and is displayed in the left pane of IIS Manager. You can start and stop Web sites individually by selecting them and using the commands in the IIS Manager Actions pane or by right-clicking and selecting the Manage Web Site menu. You can also use the appcmd .exe utility, which is discussed later in this lesson. Other settings, such as site bindings, can be modified at any time. This enables you to create, reconfigure, and stop sites individually without affecting other sites on the same server. Configuring Web Site Limits You can use Web Site Limits settings to specify maximum limitations on the amount of bandwidth and the number of connections that a Web site can support. You configure these settings to ensure that one or more sites on a server do not use excessive network bandwidth or consume too many resources. To configure Web site limits, you select the relevant Web site Lesson 1: Configuring Web Applications CHAPTER 13 653 and click Limits in the IIS Manager Actions pane. Figure 13-4 shows the default limit settings for a new Web site. FIGURE 13-4 Default Web Site limits. You can enable and use the Limit Bandwidth Usage option (which is initially disabled) to configure the maximum number of bytes per second that the Web server supports. If this limit is exceeded, the Web server throttles responses by adding a time delay. Use the Limit Number of Connections setting to specify the maximum number of user connections that can be active on the site. Each user connection times out automatically if a new request is not received within the time you specify. (The default is 120 seconds.) You can also configure the maximum number of connections allowed to the site. If this number is exceeded, users who attempt to make a new connection will receive an error message stating that the server is too busy to respond. Configuring Site Logging You configure site logging properties by selecting the relevant Web site in IIS Manager and double-clicking Logging in Features View. Figure 13-5 shows the default logging options. The options available depend on which role services are installed on the Web server. By default, each new site is configured to store text-based log files in the %SystemDrive%\ Inetpub\Logs\LogFiles path on the local server. Each Web site is assigned its own folder that contains one or more log files. The default log file format is W3C, which you can use to com- pare log information from different Web server platforms. You use the Select Fields button to specify what information is stored in the log file. The default settings generally provide a good balance between performance and useful information. If you add too many fields, this can adversely affect performance, so log only the information you need. Because log files are text-based, it can be difficult to manage and analyze large files. The settings in the Log File Rollover section enable you to specify when IIS7 should create a new log file. (The default is daily.) You can also specify the maximum size of each log file or use only a single log file. 6 5 4 CHAPTER 13 Configuring a Web Services Infrastructure FIGURE 13-5 Default logging options. Creating and Managing Web Applications You can create Web applications within Web sites to point to the physical location of content files. For example, a site might include two Web applications, one for registered users and one for nonregistered users. Each Web application typically points to a separate physical folder on the computer so IIS7 can determine how to process requests. Web applications can also ensure that the common content is available to both sites. Creating Web Applications To create a new Web application, right-click the relevant Web site in IIS Manager and click Add Application. Figure 13-6 shows the Add Application dialog box. You can specify the alias to be used for the site. This is the name that users will type as part of their URL to connect to the content. For example, if you create a Web application with the alias Marketing on the Web server Glasgow in the contoso.internal domain, users will use http://glasgow.contoso .internal/marketing to access the content. You can also specify the application pool in which the application will be placed. You learn about application pools later in this lesson . You configure the Physical Path option to specify the folder in which the Web applica- tion content is stored. This file system location should be unique and not shared with other Web applications. You can use the Connect As setting to specify a username and password or accept the default setting of Pass-Through Authentication. Use the Test Settings button to verify the connection details you have specified. When you click OK to create a new Web application, the application is listed under the site object in IIS Manager. You can modify settings for the Web application by using the IIS Manager Features View. Lesson 1: Configuring Web Applications CHAPTER 13 655 FIGURE 13-6 The Add Application dialog box. Managing Web Applications Many of the settings for a new Web application are inherited automatically by default from the Web site in which it was created. This enables you to use the same default settings easily for each new site. You can also (usually) override settings at the Web application level, based on specific application needs. To do this, double-click items in Features View and make the corresponding changes. Using Application Pools Application pools address one of the primary concerns involved in managing Web Serv- ers—when one Web site or application affects operations of others on the same computer. Memory leaks and application bugs can cause a loss of service or reduced performance in apparently unrelated Web applications. Application pools isolate different sites from each other so that failures and other problems can be contained. Within each application pool, worker processes service Web requests. Each application pool contains its own set of worker processes, so problems in one pool do not affect processes in another. In addition, you can start and stop application pools independently of each other . By default, IIS includes the Classic .NET AppPool and DefaultAppPool application pools along with an application pool that takes the same name as the application itself. Classic .NET AppPool supports applications that require .NET Framework 2.0, using Classic Managed Pipe- line Mode. DefaultAppPool supports Default Web Site. It also supports .NET Framework 2.0, but it uses the new Integrated Managed Pipeline Mode. By default, IIS Manager creates a new application pool when you create a new Web site. The application pool takes the same name as the site. This enables the processes within each Web site to run independently of each other. When you create a new Web application, you have the option of selecting from any of the available application pools. 656 CHAPTER 13 Configuring a Web Services Infrastructure For example, your network contains a Windows Server 2008 Web server that hosts mul- tiple Web sites and you want to release memory for a single Web site. You want to configure the server to release memory automatically without affecting other Web sites hosted on the same server. To do this, you create a new application pool and associate the Web site with that application pool. If you add an application to a specific pool or associate a Web site with that pool, the application and Web site settings never affect applications in or Web sites associated with other pools. If the application process crashes or you reconfigure the Web site settings, only the new application pool is affected. Creating Application Pools You can use IIS Manager to create and manage application pools. As shown in Figure 13-7, you can view details of the application pools currently on the server. FIGURE 13-7 Application pools on the server. To create a new application pool, right-click Application Pools and select Add Application Pool. Figure 13-8 shows the available options. You can use the Name option to identify the purpose of the application pool and, if relevant, the Web site it supports. The .NET Frame- work version options will be based on which versions are available on the local computer. By default, the .NET Framework 2.0 and No Managed Code options are available. If you select No Managed Code, .NET functionality will not be available for Web applications that are part of the pool. Managed Pipeline Mode specifies the supported method for code that needs to intercept and modify Web request processing. The Classic option supports ASP.NET applications writ- ten for previous versions of IIS that depend on integrating with request pipeline events. The Integrated mode provides better performance, and Microsoft recommends it for those Web applications that do not depend on Classic Managed Pipeline Mode. Before clicking OK, you can choose whether you want to start the application pool immediately. Lesson 1: Confi guring Web Applications CHAPTER 13 657 FIGURE 13-8 Available application pool options. NOTE USING THE APPCMD ADD APPPOOL COMMAND You can add an application pool to a server by using the appcmd add apppool command from an elevated command prompt, for example, %systemroot%\system32\inetsrv \appcmd add apppool /name:Sales. You can use the appcmd command to add an applica- tion pool that uses settings other than the default settings to a Web server. For example, to add an application pool named Marketing that does not run managed code and that uses classic mode, enter the %systemroot%\system32\inetsrv\appcmd add apppool /name:Marketing /managedRuntimeVersion: /managedPipelineMode:Classic command. MORE INFO ADDING APPLICATION POOLS For more information about adding application pools with both IIS Manager and command-line tools, see http://technet.microsoft.com/en-us/library/cc731784.aspx. Stopping Application Pools Each application pool on a Web server can be started and stopped without affecting any of the other pools. When you stop an application pool, this prevents any applications that are part of that pool from processing requests. Users that attempt to access content from these sites will receive an HTTP Error 503 message, “Service Unavailable.” To verify which applications are using an application pool, right-click the application pool and select View Applications. In addition to being stopped manually by an administrator, an application pool might stop automatically if application failures occur. After a certain number of failures, Rapid Fail Protection, a WAS feature, triggers. This feature is designed to stop application pools with a persistent failure condition and thus avoid an endless loop of failing to start worker processes. At this point, any requests to applications within the stopped application pool will result in the 503 error. The long-term solution is to repair or debug the failing application, but you can restart the application pool manually by running the %systemroot%\system32\inetsrv\appcmd NOTE USING THE NOTE USING THE NOTE APPCMD ADD APPPOOL COMMAND You can add an application pool to a server by using the appcmd add apppool command appcmd add apppool command appcmd add apppool from an elevated command prompt, for example, %systemroot%\system32\inetsrv \appcmd add apppool /name:Sales . You can use the appcmd command to add an applica- appcmd command to add an applica-appcmd tion pool that uses settings other than the default settings to a Web server. For example, to add an application pool named Marketing that does not run managed code and that uses classic mode, enter the %systemroot%\system32\inetsrv\appcmd add apppool /name:Marketing /managedRuntimeVersion: /managedPipelineMode:Classic command. MORE INFO ADDING APPLICATION POOLS For more information about adding application pools with both IIS Manager and command-line tools, see http://technet.microsoft.com/en-us/library/cc731784.aspx . http://technet.microsoft.com/en-us/library/cc731784.aspx.http://technet.microsoft.com/en-us/library/cc731784.aspx 6 5 8 CHAPTER 13 Configuring a Web Services Infrastructure start apppool command from an elevated command prompt on the Web Server. You must specify the name of the application pool in this command. Recycling Application Pools Rather than stopping an application pool, you can recycle it using the Recycle command in the Actions pane. This instructs IIS7 to retire any current worker process automatically after it has executed existing requests. Users do not see a service disruption, and the worker process is replaced by a new one as quickly as possible. Typically, you recycle application pools when you encounter memory leaks or when resource usage increases significantly over time and you suspect a defect in the application code. The long-term solution is to correct the code, but you can address the symptoms by recycling the application pool. You can configure recycling options by selecting an application pool in IIS Manager and then clicking the Recycling link under Edit Application Pool in the IIS Manager Actions pane. Figure 13-9 shows the recycling options available. FIGURE 13-9 Configuring Application Pool recycling settings. You can select either Fixed Intervals or Memory Based Maximums, depending upon the specific problems you are trying to troubleshoot. Recycling application pools too quickly can reduce performance, but if a Web application has serious problems, you should address them by recycling worker processes before users see slowdowns or errors on the Web site. Keep track of application pool recycle events to ensure that your Web server and its appli- cations are running as expected. For example, if you choose the Memory Based Maximums setting, you want to know how often the application pool has been recycled. Lesson 1: Configuring Web Applications CHAPTER 13 659 When the worker process terminates, a new one is started simultaneously. This type of recycling is called overlapped recycling and is the default for application pools. If an applica- tion cannot run in a multi-instance environment, configure only one worker process for an application pool, which is the default value. In this case, disable overlapped recycling by set- ting the Disable Overlapped Recycling option to True. Advanced Application Pool Settings You can configure additional application pool settings to control the behavior of worker processes. To do this, select an application pool in IIS Manager and click Advanced Settings in the Actions pane. In the Advanced Settings dialog box shown in Figure 13-10, configure the detailed parameters related to CPU and memory resource usage. In general, you should not change these parameters unless you are sure you need to. Some settings can result in reduced application processing speed, and others can reserve too many system resources for a particular pool. FIGURE 13-10 Application pool Advanced Settings dialog box. Understanding .NET Framework The .NET Framework is available with Windows Server 2008. It includes a library of pre-coded solutions to common programming problems and a virtual machine that manages the execu- tion of programs written specifically for the framework. Most new applications created for the Windows Server 2008 platform use the .NET Framework. Programs written for the .NET Framework execute in the CLR environment that manages the program’s requirements. This run-time environment simulates an application virtual machine, so programmers need not consider the capabilities of the specific hardware that 6 6 0 CHAPTER 13 Configuring a Web Services Infrastructure executes the program. CLR also provides services such as security, memory management, and exception handling. Windows Server 2008 includes .NET Framework 3.0. Version 3.5 is available as a download at http://www.microsoft.com/downloads/details.aspx?FamilyID=333325fd-ae52-4e35-b531- 508d977d32a6&DisplayLang=en and, at this time of writing, .NET Framework 4.0 for parallel computing has been recently announced. However, any examination questions are likely to be based on .NET Framework 3.0. .NET Framework Components .NET Framework 3.0 includes a set of application programming interfaces (APIs) integrated into Windows Server 2008 operating systems. It consists of the following components: n Windows Presentation Foundation (WPF) This is a user interface subsystem and API based on eXtended Markup Language (XML) that uses 3D computer graphics hard- ware and Direct3D technologies. n Windows Communication Foundation (WCF) This is a service-oriented messaging system that enables programs to interoperate locally or remotely. n Windows Workflow Foundation (WF) This enables you to build task automation and integrated transactions, using workflows. A workflow is a model that, for example, could describe a repeatable sequence of operations. n Windows CardSpace This is a software component that securely stores a user’s digital identities and provides an interface for choosing an identity for a particular transac- tion, for example, logging on to a Web site. ASP.NET is a Web application framework you can use to build dynamic Web sites, Web applications, and Web services. It is the successor to the Microsoft ASP technology. ASP.NET is built on CLR, enabling programmers to write ASP.NET code, using any supported .NET language. ASP.NET pages, known as Web forms, are used for application development. They are contained in files with an .aspx extension. They define server-side Web controls and user controls in which the developers place all the required static and dynamic content for the Web page. .NET components are defined by the .NET initiative, which aims to make interoperable software services available over the Internet anywhere and on any device. The initiative is based on the .NET Framework, which combines a managed run-time environment with a comprehensive class library to facilitate building and deploying Web-enabled applications. .NET components support programming models embodied in the .NET Framework, including Windows Forms, Web Forms, and XML Web services. [...]... service), IS-ASP, IIS-BasicAuthentication, IIS-CGI, IIS-ClientCertificateMappingAuthentication, IIS-CustomLogging, IIS-DefaultDocument, IIS-DigestAuthentication, IIS-DirectoryBrowsing, IIS-HttpCompressionDynamic, IIS-HttpCompressionStatic, IIS-HttpErrors, IIS-HTTPLogging, IIS-HttpRedirect, IIS-HttpTracing, IIS-IISCertificateMappingAuthentication, IIS-IPSecurity, IIS-ISAPIExtensions, IIS-ISAPIFilter, IIS-LegacyScripts,... IIS-LegacyScripts, IIS-LoggingLibraries, IIS-ManagementScriptingTools, IIS-ManagementService, IIS-ODBCLogging, IIS-RequestFiltering, IIS-RequestMonitor, IIS-ServerSideIncludes, IIS-StaticContent, IIS-URLAuthorization, IIS-WindowsAuthentication, IIS-WMICompatibility, WAS-ConfigurationAPI, WAS-NetFxEnvironment, WAS-ProcessModel, MSFTPSVC (installed as a service), IIS-FTPServer, INETMGR EXE, IIS-FTPManagement, IIS-LegacySnapIn,... Sites and Applications At the time of this writing, Windows Server 20 08 does not support cross-machine migration of down-level IIS versions to IIS7; however, the IIS team expects to provide an IIS7 migration tool that enables you to move existing Web sites cross-machine to IIS7 on Windows Server 20 08 You can keep track of this situation by accessing the Microsoft IIS team Web site mentioned earlier in... complete servermanagercmd.exe -install web -server -allsubfeatures -resultpath C:\Admin\MyWebServer.xml -restart MORE INFO SERVERMANAGERCMD.EXE For more information about the servermanagercmd.exe utility, see http://technet .microsoft com/en-us/library/cc7224 08. aspx and follow the links The Appcmd.exe Utility Appmd.exe is the principal command-line tool for managing IIS7 It enables you to control a Web server. .. restoration the same way as backups you made manually MORE INFO CONFiguRATiON HiSTORY For more information about configuration history and the configuration history service, see http://learn.iis.net/page.aspx/129/using-iis-7-configuration-history/ guration-history/ Monitoring and Logging Web Server Activity HTTP Logging and Request Monitor role services are installed by default and enable you to monitor... Site/" /path:/VirD2 /physicalPath:c:\vdirs\VirD2 4 The virtual directory is added, as shown in Figure 1 3-1 8 Test this by browsing to http:// localhost/VirD2 FiguRE 1 3-1 8 Adding a virtual directory with appcmd.exe Lesson Summary n You can use the IIS Migration Wizard to migrate a site in a non-Windows operating system to Windows Server 20 08 and IIS7 n The WWW and FTP publishing services publish Web and... Administration of server modules Trace Management of server trace logs Lesson 2: Managing Web Sites CHAPTER 13 673 For example, to list all the sites on a Web server, enter the following command: %systemroot%\system32\inetsrv\appcmd list sites To give a slightly more complex example, the Windows Server 20 08 Web server Boston in the tailspintoys.com domain hosts the www.tailspinstoys.com Web site You want to create... readers who have Apache servers on their production network The upgrade examinations are unlikely to test this in detail It is probably sufficient for you to know that you can carry out such a migration and that the IIS Migration Wizard is the tool you use Upgrading an IIS6 Web Site If you upgrade a Windows Server 2003 Web server with IIS6 installed to a Windows Server 20 08 Web server with IIS7 installed,... http://technet .microsoft. com /en-us/library/cc766357.aspx /en-us/library/cc766357.aspx Servermanagercmd accepts parameters that install or remove a role, role service, or feature When you want to install or remove more than one role, role service, or feature on a server by using a single command instance, you can use an XML answer file The command can take the -query (-q), -logpath, -inputpath (-p), -install, -remove,... All servers on the A Datum Corporation network run Windows Server 20 08 The Galveston Web Server hosts a Web application called StockControl that uses a custom application pool, which is set to recycle every 720 minutes The StockControl application does not support multiple worker processes Which of the following options should you choose to configure the application pool so that users can access StockControl . IS-ASP, IIS-BasicAuthentication, IIS-CGI, IIS-ClientCertifi cate- MappingAuthentication, IIS-CustomLogging, IIS-DefaultDocument, IIS-DigestAuthentication, IIS-DirectoryBrowsing, IIS-HttpCompressionDynamic,. IIS-ISAPIFilter, IIS-LegacyScripts, IIS-Logging Libraries, IIS-ManagementScriptingTools, IIS-ManagementService, IIS-ODBCLogging, IIS-Request- Filtering, IIS-RequestMonitor, IIS-ServerSideIncludes, IIS-StaticContent,. the tool you use. Upgrading an IIS6 Web Site If you upgrade a Windows Server 2003 Web server with IIS6 installed to a Windows Server 20 08 Web server with IIS7 installed, Web sites on the server