Maximizing.ASP.dot.NET.Real.World.ObjectOriented.Development [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Maximizing.ASP.dot.NET.Real.World.ObjectOriented.Development [Electronic resources] - نسخه متنی

Jeffrey Putz

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






IIS: The First Step


Internet Information Services is the part of the Windows operating system that services requests to your Web site. The IIS Manager shows a tree of sites grouped under the Web Sites group, as shown in Figure 6.1. Each site is set to take requests by IP address, port (normally port 80), and a host header value, which allows one IP to be used for several sites.

Figure 6.1. IIS with open site property sheet.

Chapter 8, "HttpHandlers and HttpModules").


The preceding description isn't technically the whole story. A driver called http.sys actually gets the request first in Windows Server 2003 (IIS v6.0). It passes off the processing to one worker process instance (w3wp.exe) for each application pool. In IIS v5.x in Windows 2000 and Windows XP, the request is first received by inetinfo.exe, which sends it to aspnet_isapi.dll and then to the ASP.NET worker process, aspnet_wp.exe. IIS6 has a shorter pipeline, so ASP.NET requests are generally handled more quickly.

Your server already has some of this mapping set up for you, provided you have enabled ASP.NET (it is not turned on by default as a security precaution in Windows Server 2003, though it is easily turned on via the "Web Service Extensions" node in the IIS control panel). Figure 6.2 shows the IIS dialog used to map these extensions, whereas Figure 6.3 shows the dialog that appears when you click Edit in Figure 6.2. (The application configuration dialog in Figure 6.2 can be found by clicking the "configuration" button on the Home Directory tab of the site properties.) In plain English, this tells the server, "If you get a request for a file ending in '.aspx,' send it to the program aspnet_isapi.dll to execute." The "Verify that file exists" checkbox will cause IIS to check to see if an actual file by that name exists, and if not, IIS will return a 404 "not found" error. As you'll see later, we don't necessarily need to have an existing file to handle a request.

Figure 6.2. Application configuration dialog in IIS.

Figure 6.3. Editing the mapping of a file extension to an application.

You might be wondering what happens when the request does not include any particular file name, and therefore no file extension (such as a request for http://www.microsoft.com or http://www.microsoft.com/sql). In those cases, IIS will try to load default pages, in the order specified on the Documents tab of the site's properties. Figure 6.4 shows this tab, indicating that default.aspx is the first one to try.

Figure 6.4. Specifying default documents.

You can also force every request to be handled by a particular ISAPI program. This is handy when you want to build a site that interprets the request's URL and executes some other page. It's also useful when you need to process certain files, such as images, before sending them back to the user's browser. To have ASP.NET process all requests, you must add a wildcard map, which is also shown in Figure 6.2. It opens up a dialog almost exactly like the one in Figure 6.3, except that it doesn't apply to any one particular file extension. The application you specify for the wildcard is the same aspnet_isapi.dll that handles .aspx, .asax, .asmx, and other requests.


Prior to IIS 6, wildcards were accomplished by adding an additional entry to the application extensions part of the dialog by specifying ".*" as an extension.

In the event that your mappings to ASP.NET somehow are removed or altered in a way that prevents ASP.NET from getting normal requests, a command line utility is included to fix these all at once. If you navigate to C:\WINDOWS\Microsoft.NET\Framework\v2.x.xxxx (where the last part indicates the version of the framework you want to use, with v1.1.4322 being the production release of v1.1 of the .NET Framework), you'll find a program called aspnet_regiis.exe. Execute this file at a command prompt, and you'll get a list of switches that will restore these maps and install the client-side JavaScript for certain Web controls in the root of each site.


/ 146