intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Exchange SQL And IIS- P173

Chia sẻ: Cong Thanh | Ngày: | Loại File: PDF | Số trang:5

47
lượt xem
2
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Exchange SQL And IIS- P173:The following legacy Exchange features have been de-emphasized in Exchange Server 2007. What does that mean? It means that these features are still included in the Exchange product, but they’re not prioritized anymore, and will most likely disappear in the next Exchange release after Exchange Server 2007

Chủ đề:
Lưu

Nội dung Text: Exchange SQL And IIS- P173

  1. Administration of an IIS 7.0 Web Server • Chapter 16 837 MWA, like all of our other toolsets, can only work against an IIS 7.0 server, thus causing you to use other administration tools to administer previous versions of IIS. Getting Started with MWA Using Microsoft.Web.Administration isn’t necessarily the most convenient methodology for many administrators. However, there are a great deal of developers who would like to set up packages for their Web applications using Visual Studio, and MWA makes this extremely simple. Imagine you are a developer for your company and you have an HR application you have built and would like to create the setup so that all administrators are required to do is click setup.exe. With your project in Visual Studio, you can easily add a reference in your setup project to MWA and add logic to execute configuration changes to IIS 7.0. You also can build console applications that would allow you to interface with the various server objects to give you quick access to executing requests, site status, or ASP.NET application domains. In our example, we will take you through doing some simple administration using a compiled executable that is reusable throughout your Web infrastructure. Using C# Express to Create a Console Application The first step is to download a flavor of Visual Studio 2005 that works for you. For many, you already have Visual Studio 2005 and can’t skip this step. However, if you do not have access to Visual Studio, you can download one of the Visual Studio Express Editions, such as Visual C# Express (available for download at http://msdn.microsoft.com/vstudio/express/visualcsharp/). To create a console application project in C# express, add a reference to the Microsoft.Web. Administration library. To do this, perform the following steps: 1. Open Visual Studio 2005 or Visual C# Express Edition. 2. Enter your project name and select your save location. 3. Click Project and Select Add Reference. 4. Click the Browse tab. 5. Browse to %windir%\system32\inetsrv. 6. Select Microsoft.Web.Administration.dll. 7. Click OK.
  2. 838 Chapter 16 • Administration of an IIS 7.0 Web Server SOME INDEPENDENT ADVICE Microsoft.Web.Administration shipped as part of Windows Vista. The entire API documentation is available on Microsoft’s MSDN Web site at http://msdn2.microsoft. com/en-us/library/microsoft.web.administration. Figure 16.8 Create Your MWA Project
  3. Administration of an IIS 7.0 Web Server • Chapter 16 839 Figure 16.9 Add an MWA Reference on Windows Vista Accessing Runtime Information with MWA As you have learned, MWA is simple and easy to use to create Web sites, application pools, and applications. It can also be used easily access configuration attributes and properties on those Web sites such as authentication, default documents, and much more. IIS 7.0 offers more than just configuration data—server objects and runtime data are also accessible using MWA. This includes server objects such as site status, application pool status, and ASP.NET application domains. These state objects are not represented in any configuration file and instead are stored within the worker process or Web Application Services (WAS) process. Creating a Web Site Using MWA It is a fundamental first step as we have seen when doing administration to create a Web site. You will need to understand how to instantiate the MWA objects and create the new site. Lastly, you will call the commit method to ensure that the new changes are committed to file.
  4. 840 Chapter 16 • Administration of an IIS 7.0 Web Server using System; using System.Collections.Generic; using System.Text; using Microsoft.Web.Administration; namespace MSWebAdmin_Application { private static void CreateSite() { using (ServerManager serverManager = new ServerManager() ) { Site site = serverManager.Sites.Add(“My First MWA Site”, @“%SystemDrive%\ inetpub\wwwroot”, 8080); site.ServerAutoStart = true; serverManager.CommitChanges(); } } In this sample, we grabbed the ServerManager object and created a new instance. After that, we simply set the variable (myFirstMWASite) so we can use it later while also creating the new site using the Add method. Lastly, we set the site auto start status to True so that after creating the site it will automatically be started. Shortcut… Setting the Auto Start Status This is often a confusing concept for IIS veterans. What exactly does the term site status mean? It is important to understand that it is possible to have a site created though not running. This is often the case in staging or development environments. When ServerAutoStart is set to false, you cannot access the Web site using the bindings (e.g., URL) until the administrator or site administrator enables it. This step isn’t required since the site will auto-start when you create it unless you explicitly set it to false. It should be noted that if you are creating a site without providing bindings that are unique, you should set ServerAutoStart to false until you set the bindings to be unique.
  5. Administration of an IIS 7.0 Web Server • Chapter 16 841 Creating Virtual Directories Using MWA using System; using System.Collections.Generic; using System.Text; using Microsoft.Web.Administration; namespace MSWebAdmin_Application { Class CreateVirtualDirectory(“My First MWA Site”,“/”, “/VDir”, “C:\\temp”); private static void CreateVirtualDirectory(string siteName, string applicationPath, string virtualDirectoryPath, string physicalPath) { using (ServerManager serverManager = new ServerManager() ) { Site site = serverManager.Sites[siteName]; Application app = site.Applications[applicationPath]; app.VirtualDirectories.Add(virtualDirectoryPath, physicalPath); serverManager.CommitChanges(); } } In this example, we create a virtual directory called for the site My First MWA site with the one single application. In this case, we point the root application and virtual directory content path to c:\temp. Adding Application Pools Using MWA In order to set My First MWA Site to run as isolated and in its own application pool, you must create the application pool and then assign the site’s root application to run in this newly created application pool. In this example, we will accomplish two goals: 1. Create a new application pool. 2. Assign the path My First MWA Site/ (root application) to your new application pool.
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
3=>0