1. Trang chủ
  2. » Công Nghệ Thông Tin

Exchange SQL And IIS- P174 pdf

5 124 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 49,73 KB

Nội dung

842 Chapter 16 • Administration of an IIS 7.0 Web Server To create a new application pool, use the following: using System; using System.Collections.Generic; using System.Text; using Microsoft.Web.Administration; namespace MSWebAdmin_Application { class CreateApplicationPool() { private static void CreateApplicationPool() { using (ServerManager serverManager = new ServerManager() ) { ApplicationPool appPool = serverManager.ApplicationPools.Add(“My First MWA AppPool”); appPool.ProcessModel.UserName = “<User>”; appPool.ProcessModel.Password = “<Password>”; } } } Assign My First MWA Site to the new application pool: using System; using System.Collections.Generic; using System.Text; using Microsoft.Web.Administration; namespace MSWebAdmin_Application { class AssignApplicatonPoolToSite(“My First MWA Site”, “/”, “My First MWA AppPool”); private static void AssignApplicationPoolToSite(string siteName, string applicationPath, string applicationPoolName) { using (ServerManager serverManager = new ServerManager() ) { serverManager.Sites[siteName].Applications[applicationPath].ApplicationPoolName = applicationPoolName; serverManager.CommitChanges(); } } } Administration of an IIS 7.0 Web Server • Chapter 16 843 Changing the Authentication Type for a Web Site Using MWA Multiple properties are customizable for your Web sites, yet many times you will not touch them. The principles often are the thing to grasp, and in this illustration we will touch on one of those often changed settings: authentication. The goal though is to get away from creating sites or virtual directories and modifying actual site settings. This could stretch to things like adding modules, handlers, default documents, and much, much more. In this example, you will enable Windows authentication for our newly created Web site. using System; using System.Collections.Generic; using System.Text; using Microsoft.Web.Administration; namespace MSWebAdmin_Application { class EnableWindowsAuthentication(“My First MWA Site”) private static void EnableWindowsAuthentication(string siteName) { using (ServerManager serverManager = new ServerManager() ) { Confi guration appHostConfi g = serverManager.GetApplicationHostConfi guration(); // Enable Windows Authentication Confi gurationSection windowsAuthentication = appHostConfi g.GetSection(“system.webServer/security/authentication/ windowsAuthentication”, siteName); windowsAuthentication.SetAttributeValue(“enabled”, true); // Disable Anonymous Authentication Confi gurationSection anonymousAuthentication = appHostConfi g.GetSection(“system.webServer/security/authentication/ anonymousAuthentication”, siteName); anonymousAuthentication.SetAttributeValue(“enabled”, false); serverManager.CommitChanges(); } } } 844 Chapter 16 • Administration of an IIS 7.0 Web Server Viewing Currently Executing Requests Using MWA To access currently executing requests in IIS 7.0 using MWA, you do much of what you did earlier except you change the object you are using so it points to IIS 7.0 runtime objects. In this example, you will need to ensure you have executing requests running to ensure that data is returned. In this example, you will view any currently executing requests occurring in IIS 7.0: using System; using System.Collections.Generic; using System.Text; using Microsoft.Web.Administration; namespace MSWebAdmin_Application { class DisplayRequests () private static void DisplayRequests() { using (ServerManager serverManager = new ServerManager() ) { foreach (WorkerProcess workerProcess in serverManager.WorkerProcesses) { Console.WriteLine(workerProcess.ProcessId); foreach (Request request in workerProcess.GetRequests(0) ) { Console.WriteLine(“{0} - {1} - {2}”, request.Url, request.PipelineState, request.TimeElapsed); } } } } } Administration of an IIS 7.0 Web Server • Chapter 16 845 Summary Like Baskin Robbins’ 31 fl avors, IIS 7.0 has a talented array of administration features. Whether you subscribe to the user interface fl avor, command line, or writing scripts or code, there is a fl avor for everyone. Unlike previous IIS versions, there has never been such a powerful lineup of confi guration opportunities for Microsoft’s Web platform. As an administrator or developer, you must pick the tool that is right for your environment. You can select IIS Manager for a user interface experience, AppCmd.exe when using the command line, or use WMI or Microsoft.Web.Administration for scripting changes in IIS 7.0’s confi guration and to access runtime data. In this chapter, you have gained insight into the powerful stack of administration capabilities built directly into IIS 7.0. There is a method for manipulating the IIS 7.0 confi guration that fi ts any fl avor of administrator from the user interface to the managed-code administrator. This isn’t to say that IIS 7.0 has everything in-between. It was important to start with the most common toolset used for day-to-day administration: IIS Manager. IIS Manager, re-built from the ground up, provides a new look and feel while maintaining most of the necessary tools to completely manage IIS. It offers you the ability to manage both IIS and ASP.NET settings in a consolidated, grouped, approach as well as provide you with delegated administration. IIS Manager supports both previous clients such as Windows XP and Windows 2003 Server, along with Windows Vista and Windows Server “Codenamed” Longhorn. You can download IIS Manager from the IIS.NET DownloadCENTER at www.iis.net/downloads/default.aspx?tabid=3. For some, the experience of learning IIS Manager is tedious and not what they desire to do. They prefer to use the command line to improve their experience with IIS 7.0’s confi guration. IIS 7.0 offers a powerful desktop command-line interface called AppCmd.exe that offers access using simple syntax and strong object support. From creating Web sites to viewing currently executed requests or migrating legacy confi guration, AppCmd.exe offers a Swiss-army-knife-like experience for those desiring command-line support. The reality in the Web server world is in deployments, not in doing individual tasks that IIS Manager and AppCmd.exe specialize in. For those desiring automated, deployable, and maintainable scripts, IIS 7.0 offers you the ability to use WMI and MWA. In the end, IIS 7.0 provides a complete end-to-end story in the administration space, offering the best lineup of toolsets ever shipped with IIS. Solutions Fast Track Accomplishing Tasks Using IIS Manager ˛ IIS Manager offers easy access to all relevant features in an excellent three-column view. ˛ Creating Web sites, virtual directories, and much more is simple and intuitive with the redesign of IIS Manager. ˛ IIS Manager in IIS 7.0 offers a consolidated interface for managing IIS and ASP.NET settings. 846 Chapter 16 • Administration of an IIS 7.0 Web Server Accessing Information Using AppCmd.exe ˛ AppCmd.exe offers command-line access to IIS 7.0 confi guration, server objects, and runtime data, such as requests executing. ˛ AppCmd.exe offers powerful object access, including creating and managing confi guration backups for applicationhost.confi g. ˛ AppCmd.exe is available in %windir%\system32\inetsrv, but is easily addable to the system path for quick access. Writing Scripts Using the New WMI Provider ˛ WMI is rewritten in IIS 7.0 to support IIS’s new confi guration as well as extensibility. ˛ WMI is a nice means of automating tasks that are repetitive and usable across many machines. ˛ WMI can perform all the same tasks as IIS Manager and AppCmd.exe, all from a scripting, remotable interface. Managed Code Administration: Inside Microsoft.Web. Administration ˛ Microsoft.Web.Administration (MWA) offers managed-code users the ability to manage IIS 7.0 confi guration and other data. ˛ MWA supports all the .NET Framework languages and is easy to add as a reference in Visual Studio. ˛ MWA, like all other toolsets, is capable of creating Web sites, virtual directories, applications, and much, much more. . Manager is tedious and not what they desire to do. They prefer to use the command line to improve their experience with IIS 7.0’s confi guration. IIS 7.0 offers a powerful desktop command-line interface. virtual directories, and much more is simple and intuitive with the redesign of IIS Manager. ˛ IIS Manager in IIS 7.0 offers a consolidated interface for managing IIS and ASP.NET settings. 846. offers command-line access to IIS 7.0 confi guration, server objects, and runtime data, such as requests executing. ˛ AppCmd.exe offers powerful object access, including creating and managing

Ngày đăng: 06/07/2014, 13:20

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN