荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: Jobs (温少), 信区: Visual
标  题: Introducing Active Server Pages +
发信站: BBS 荔园晨风站 (Sun Sep 17 02:06:47 2000), 转信



Introducing Active Server Pages +

Even though the ink is barely dry on the documentation for Active Server
Pages 3.0, Microsoft is already hard at work on the next generation of
their core server-side programming technology. In this specially
commissioned series of three articles, we introduce this new product,
and look at what it is all about. Currently called ASP+ Next Generation
Web Services (though this name might yet change) we'll see why we need a
new version of ASP, and explore the concepts behind its design and
implementation. While these articles are aimed predominantly at
experienced developers who have used ASP before, we start out here by
examining some of the core issues involved when you decide to migrate to
ASP+.

ASP+ is designed to be backwards-compatible with earlier versions of
ASP, with only minor changes required in some circumstances. However,
more to the point, you can install ASP+ on an existing Windows 2000
server alongside ASP 3.0. This allows you to experiment with the new
version, without requiring a separate 'test bed' server. You can
continue using existing ASP applications, and migrate them to ASP+ when
you are ready, so your investment in ASP is not lost.

But simply porting your applications to ASP+ will only give you a few of
the benefits the new version offers. ASP+ has many new features that
provide far greater ease of use, more power and better runtime
efficiency, but to take advantage of them you will need to understand
more about the way that ASP+ works.

At the Professional Developer's Conference 2000, which is currently in
full swing this week (11-14 July) in Orlando, Forida, Microsoft have
released a preview version of ASP+ to allow developers to see what it
can do, and get to grips with the exciting new possibilities for
building dynamic Web applications while writing far less code than ever
before.


The Evolution of Active Server Pages
Although it seems to have been around forever, Active Server Pages is
only some three-and-a-bit years old. Since its inception in late 1996,
it has grown rapidly to become the major technique for server-side Web
programming in the Windows environment (and on some other platforms
using other implementations that accept the same or similar syntax, such
as ChilliASP). But it didn't come from nowhere ?the foundations lie much
further back than that.

Dynamic Server-side Web Programming
Traditionally, dynamic Web pages have been created using server-side
executable programs. A standardized Web server interface specification
called the Common Gateway Interface (CGI) allows an executable program
to access all the information within incoming requests from clients. The
program can then generate all the output required to make up the return
page (the HTML, script code, text, etc.), and send it back to the client
via the Web server.


To make the programmer's life easier, and save having to create
executable programs, languages such as Perl use an application that
accepts text-based script files. The programmer simply writes the
script, and the Web server executes it using a Perl interpreter.

Microsoft ISAPI Technologies
Microsoft introduced another Web server interface with their Web server,
Internet Information Server. This is called Internet Server Application
Programming Interface (ISAPI), and differs from CGI in that it allows
compiled code within a dynamic link library (DLL) to be executed
directly by the Web server. As with CGI, the code can access all the
information in the client request, and it generates the entire output
for the returned page.

Most developments in Microsoft's Web arena have been based on the ISAPI
interface. One early and short-lived product was dbWeb, a data access
technology that provided a range of searching, filtering and formatting
capabilities for accessing data stored on the server, and for
interacting with the client


A second development was the Internet Database Connector (IDC). This
proved a big hit with developers ?not only because it was fast and
efficient (unlike dbWeb), but also because it was a lot more generic and
easier to program. IDC introduced the concept of templates, allowing
programmers to easily adapt existing HTML pages to use its features and
quickly build new applications around it.

IDC uses two text files for each 'page'. The first is a simple script
that defines the way that the data should be collected from the
server-based database. In essence, it is just a SQL statement plus some
configuration information:


{this is the query file named getuserlist.idc}
Datasource: GlobalExampleData
Username: examples
Password: secret
Template: getuserlist.htx
SQLStatement:
+ SELECT DISTINCT UserName
+ FROM Person ORDER BY UserName;

The server executes this file to obtain the results recordset, then
loads a template file:

{this is an extract from the template file named getuserlist.htx}
...
<TABLE>
  <TR>
    <TD>User name:</TD>
    <TD>
      <SELECT NAME=selUserName>
        <%BeginDetail%>
         <OPTION VALUE="<%UserName%>"><%UserName%>
        <%EndDetail%>
      </SELECT>
    </TD>
  </TR>
</TABLE>
...

The template is just an ordinary Web page, including HTML, text and
other objects, but with one or more specially delimited placeholders
inserted. And the syntax for these placeholders, and the other simple
program code constructs that are supported, is eerily like ASP. Of
course, it was from this that ASP actually evolved:


The Versions of ASP
So, it was in early 1996 that Denali (the codename for ASP) was released
as a beta version 0.9 product, and it took the Web-development world by
storm. The ability to execute code inline within a Web page was so
simple and yet so powerful. With the provision of a series of components
that could perform advanced features, most notably ActiveX Data Objects
(ADO), it was almost child's play to create all kinds of dynamic pages.



The final release version of Active Server Pages 1.0, available as an
add-on for IIS 3.0, was soon in use on Windows platforms all over the
place. The combination of ASP with ADO enabled developers to easily
create and open recordsets from a database. There's no doubt that this
was one of the main factors for it's rapid acceptance, because now you
could create and open recordsets from a database within the script, and
manipulate and output any values, in any order, almost any way you
wanted.

In 1998, Microsoft introduced ASP 2.0 as part of the free Windows NT4
Option Pack. The major difference between this release of ASP and
version 1.0 was in the way that external components could be
instantiated. With ASP 2.0 and IIS 4.0, it is possible to create an ASP
application, and within it run components in their own separate memory
space (i.e. out of process). The provision of Microsoft Transaction
Server (MTS) also made it easy to build components that can partake in
transactions.

Windows 2000, COM+ and ASP 3.0
Early this year, Windows 2000 arrived. This contains version 5.0 of IIS,
and version 3.0 of ASP. Other than some minor additions to ASP, the core
difference here is actually more to do with COM. In Windows 2000,
Microsoft combined MTS with the core COM runtime to create COM+. This
provides a host of new features that make the use of components easier,
as well as giving a much more stable, scalable and efficient execution
platform.

Other than a few minor changes to the management interface, IIS has not
changed a great deal on the surface. However, underneath, it now uses
COM+ Component Services to provide a better environment for components
to be executed within, including out of process execution as the default
and the option to run each component in its own isolated process if
required.

ASP+ and the Next Generation Web Services Framework
All this brings us to the present, with ASP+. The underlying structure
of ASP+ is very different to that of previous versions, although from
the 'outside' (as far as the developer is concerned) it does appear to
offer a very similar interface. ASP+ is almost entirely component-based
and modularized, and every page, object, and HTML element you use can be
a runtime component object.


For this to perform efficiently, and provide a scalable solution, the
management of these objects is a very necessary pre-requisite. The new
runtime environment carries out this management automatically, allowing
ASP+ to become far more object-oriented in nature. This allows
developers to build more powerful applications by accessing these
component objects in a far more granular and controlled manner.

On top of that, the object orientation of ASP+ provides extensibility
for the environment as a whole. Developers can add to and extend the
environment, both by creating new components or inheriting from the base
classes that create them, and over-riding selected behavior as required.
Under the hood, the COM+ runtime manages the instantiation, pooling and
allocation of the objects automatically.

The Next Generation Web Services Framework
So, COM+ provides a framework of operating system services. But that's
not the whole story. ASP+ is actually a part of a brand new runtime
framework that provides support for all kinds of applications in
Windows. The framework is a key part of Microsoft's Next Generation Web
Services or NGWS. When you install this framework, you get ASP+ as part
of the package. The framework supports all other server-side programming
techniques as well, such as a new managed component service, support for
building executable applications and Windows Services, access to
performance counter APIs and Event Log APIs, etc.


The NGWS framework extends the Component Object Model (COM) architecture
that we use to create re-usable and interoperable software components by
adding new and enhanced services for scalable distributed applications:

A unified, rich set of programming libraries
A secure, multi-language runtime engine
Simplified application creation, deployment and maintenance.
Increased scalability for distributed applications.
Protection of existing software and training investments.
We'll look at how it does all these things next.

What is the NGWS Framework?
The integration of ASP into the operating system differs remarkably from
earlier versions of ASP, which were basically just add-ons to the
operating system. Up until now, ASP has been implemented through an
ISAPI DLL named asp.dll, plus a few new system files and the ASP user
components that came as part of the package (such as the Browser
Capabilities component).

The new NGWS framework reflects the information technology industry's
changing view of the needs for creating, deploying, and maintaining Web
services of all types ?ranging from simple client applications to the
most complex distributed architectures. The overall concept and strategy
is part of the Windows Distributed Internet Applications (DNA)
architecture.

However, the important part to recognize is that the framework is not
just there for ASP+. It acts as a base for all kinds of applications to
be built on Windows. The following diagram shows how the framework
supports ASP+ Applications:




The NGWS framework provides an execution engine to run code, and a
family of object oriented classes and components that can be used to
build applications. It also acts as an interface between applications
and the core operating system. You might ask why we need such a layer,
when existing applications can talk to the core operating system and
services quite easily. The reason is that it allows applications to use
the operating system to best advantage, in a standard way that permits
faster and simpler development ?something that is increasingly necessary
in today's competitive commercial environment.

To achieve these aims, the framework implements many of the features
that the programmer, or the specific programming language environment,
had to provide themselves. This includes things like automatic garbage
collection, rich libraries of reusable objects to meet the needs of the
most common tasks, and improved security for applications. This last
point, of course, is becoming more important with the spread of
networked applications ?especially those that run over the Internet.


A Common Intermediate Language
However, one of the biggest advantages that the NGWS framework provides
is a language-neutral execution environment. All code, irrespective of
the source language, is compiled automatically into a standard
intermediate language ( IL) ?either on command or when first executed
(in the case of ASP+). The framework then creates the final binary code
that makes up the application and executes it. The compiled IL code is
used for each request until the source code is changed, at which point
the cached version is invalidated and discarded.

So, whether you use Visual Basic, C#, JScript, Perl or any of the other
supported languages, the intermediate code that is created is (or should
be) identical. And the caching of the final binary object code improves
efficiency and scalability at runtime as well.

**C# is the new language from Microsoft especially designed for use with
the Next Generation Web Services framework and ASP+. It combines the
power and efficiency of C++ with the simplicity of Visual Basic and
JScript.**

One thing that this achieves is the ability to call from one language to
another, and even inherit from objects created in one language and
modify them within another language. For example, you can inherit an
object that is written in C# in your VB program and then add methods or
properties, or over-ride existing methods and properties. In fact, parts
of the framework, and the entire ASP+ object model, are now implemented
internally using C# rather than C++.


So, the new framework introduces a true multi-language platform for
programming any kind of application. As most of our current development
is in the area of distributed applications, especially Internet- and
Intranet-based applications, many of the new features are directly aimed
at this type of development.

The Web Application Infrastructure
The three sections shown highlighted in the previous diagram (and
repeated in the next diagram) are those that implement ASP+ itself, and
which we're interested in:

 Together, these three sections implement the Web Application
Infrastructure that works with the new framework provide a range of
exciting new features:

User Interface Support
As part of the ASP+ libraries, there are a host of intelligent
server-based rich controls for building Web-based user interfaces
quickly and simply. They can output HTML 3.2 code for down-level
browsers, while taking advantage of the universal runtime libraries for
enhanced interactivity on richer clients such as Internet Explorer 4 and
above. These server-based controls can also be reused to build controls
composed of other controls, inheriting implementation and logic from
these constituent controls.


Data Access Support
The universal runtime provides a new version of ADO, called ADO+, which
offers integrated services for accessing data ?regardless of the format
or location of that data. ADO+ presents an object-oriented view of
relational data, giving developers quick and easy access to data derived
from distributed sources.

ADO+ also improves support for, and to some extent relies on, XML. ADO+
can automatically persist and restore recordsets (or datasets as they
are now called) to and from XML. As we'll see, this is particularly
useful when passing data around the Web using ASP+ Web Services.


Scalability for Distributed Applications
Two of the major requirements for any Web-based application are a robust
operating platform, and scalability to allow large numbers of multiple
concurrent requests to be handled. The NGWS runtime provides these
features by allowing automatic error and overload detection to restart
and manage the applications and components that are in use at any one
time. This prevents errant code or memory leaks from soaking up
resources and bringing the server to a halt.

There are also new and updated system and infrastructure services,
including automatic memory management and garbage collection, automatic
persistence and marshaling, and evidenced based security. Together these
features provide for more scalable and reliable resource allocation and
application processing.


Existing Software and Training Investments
Despite all the changes to the core operating system and runtimes, great
care has been taken to maintain backward compatibility with earlier
versions of Windows, COM and ASP. In most cases, existing applications,
COM and COM+ components, ASP pages, and other scripts and executables
work under the NGWS runtime. Alternatively, you can update them in your
own time as your business requirements demand.

This text is an excerpt from the new Wrox book - A Preview of Active
Server Pages + (ISBN: 1-861004-75-3). For more details of this book,
click here.

In tomorrow's article we'll look at how ASP+ is different from the ASP
that we use today, and how it can save us writing code to perform the
common tasks that are required in almost every dynamic Web page or Web
application.


--


   我想超越这平凡的生活,注定我暂时漂泊!

   我无法停止我内心的狂热,对未来的执着!

※ 来源:·BBS 荔园晨风站 bbs.szu.edu.cn·[FROM: 192.168.18.211]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店