asp net 3.5unleashed

Page 456

ASP.NET is an ISAPI DLL (implemented in ASPNet_ISAPI.dll). When a client requests a URL handled by the ASP.NET ISAPI DLL, ASP.NET creates what is called a worker process (ASPNet_wp.exe). A worker process is a Windows process that hosts a CLR COM server. When a client makes a request of a Web application, ASP.NET determines if this is the first time a request has been made. If it is, ASP.NET tells the CLR to create a new AppDomain for this Web application; each Web application is identified by its virtual root directory. ASP.NET then tells the CLR to load the assembly that contains the type exposed by the Web application into this new AppDomain, creates an instance of this type, and starts calling methods in it to satisfy the client’s Web request. If the code references more types, the CLR will load the required assemblies into the Web application’s AppDomain. By the way, strongly named assemblies (such as System.Web.dll) are loaded in a domain-neutral fashion to conserve operating system resources. When future clients make requests of an already running Web application, ASP.NET doesn’t create a new AppDomain; instead, it just uses the existing AppDomain, creates a new instance of the Web application’s type, and starts calling methods. The methods will already be JIT compiled into native code, so the performance of processing all subsequent client requests is excellent. If a client makes a request of a different Web application, ASP.NET tells the CLR to create a new AppDomain. This new AppDomain is typically created inside the same worker process as the other AppDomains. This means that many Web applications run in a single Windows process, which improves the efficiency of the system overall. Again, the assemblies required by the different Web application are loaded into its own AppDomain.

Microsoft Internet Explorer When you install the .NET Framework, it installs a MIME filter (MSCorIE.dll) that gets hooked into Internet Explorer versions 5.01 and later. This MIME filter handles downloaded content marked with a MIME type of “application/octet-stream” or “application/xmsdownload”. When the MIME filter detects a managed assembly being downloaded, it calls the CorBindToRuntimeEx function to create a CLR COM server; this makes Internet Explorer’s process a host. The MIME filter is in control of the CLR and ensures that all assemblies from one Web site are loaded into their own AppDomain. This allows an administrator to treat assemblies downloaded from different Web sites in different ways, say, trusting assemblies from one Web site but not those from another. This also allows assemblies used by one Web application to be unloaded when the user surfs to a different Web application.

“Yukon” The next version of Microsoft SQL Server (code-named “Yukon”) is an unmanaged application because most of its code is still written in unmanaged C++. During initialization, however, “Yukon” will create a CLR COM server. “Yukon” allows stored procedures to be written in any managed programming language (C#, Visual Basic, Smalltalk, and so on). These stored procedures will run in their own AppDomain that has special evidence applied to it prohibiting the stored procedures from adversely affecting the database server. “Yukon” can instruct the CLR to load just the desired assembly and to call methods in that assembly that will execute under the necessary security restrictions. This functionality is absolutely incredible! It means that developers will be able to write stored procedures in the programming language of their choice. The stored procedure can use strongly typed data objects in its code. The code will also be JIT compiled into native


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.