Developing and Deploying Web Applications using ASP and Microsoft Internet Information Server
With IIS 4.0, Microsoft introduces a new paradigm to the Web--transactional applications. Transactions are the plumbing that now make it possible to run real business applications with rapid development, easy scalability and ATOMIC reliability.
IIS 4.0 brings together the power of Windows NT Server, with the best of client/server development, and the ubiquity of the Internet to create the first Web platform for true distributed applications.
In this section, you will learn about:
Easy application development with Active Server Pages.
Integration with Microsoft Transaction Server.
Message Queuing.
Accessing data.
Building scalable and reliable applications.
Debugging.
IIS software development kit.
EASY APPLICATION DEVELOPMENT WITH ACTIVE SERVER PAGES
Active Server Pages (ASP) is a server-side scripting environment that you can use to create and run dynamic, interactive Web server applications. ASP allows you to combine HTML, scripting, and components to create dynamic interactive Web content or powerful Web-based applications.
ASP is an approachable, language neutral, compile-free environment that allows users of all levels to easily create dynamic Web content or powerful Web based applications. It has benefits for:
HTML authors
Experienced script authors
Developers
FOR HTML AUTHORS
If you are an HTML author, you will find that ASP scripts are an easy way to begin creating interactive pages. If you have ever wanted to collect information from an HTML form, personalize an HTML document with a customer's name, or use different HTML features based on the browser, you will find that ASP provides a compelling solution.
Previously, to collect information from an HTML form, you would have had to learn a programming language and build a Common Gateway Interface (CGI) script. Now you can collect and analyze data from a form by using simple instructions that you embed directly into your HTML documents. You do not need to learn a full programming language or compile programs separately to create interactive pages.
As your skills with ASP and scripting languages grow, you can create increasingly complex scripts. With ASP, you can easily use ActiveXTM components to perform complex tasks, such as connecting to a database to store and retrieve information or executing business rules.
FOR THE EXPERIENCED SCRIPT AUTHOR
If you already know a scripting language, such as VBScript, JavaScript or PERL, you already know how to use Active Server Pages. In your ASP scripts you can use any scripting language for which you have installed a scripting engine that follows the ActiveX Scripting standard.
ASP scripts use the same syntax as Windows Scripting Host scripts. This means that you can create a single script to automate tasks. For example, in IIS an administration script to set up a new Web server with customized setting could be run with parameters passed from a Web form or the command line.
IIS 4.0 includes scripting engines for Microsoft® Visual Basic® Scripting Edition (VBScript) and Microsoft® JScript so that you can immediately begin writing scripts. Microsoft Jscript is the industry's first 100% ECMA-compliant scripting language. ActiveX Scripting engines for PERL and REXX are available through third-party developers.
FOR THE DEVELOPER
If you already know a programming language, like Visual Basic, you will find ASP pages a flexible way to quickly create Web applications. By incorporating script commands into HTML documents, you create an HTML interface for your application. By creating your own Active server components, you can encapsulate your application's business logic into reusable modules that you can call from a script, from another component, or from another program.
This translates into tangible benefits, enabling Web providers to provide interactive business applications rather than merely publishing content. For example, a manufacturer can go beyond simply publishing product lists. They can use ASP to easily build a Web application that allows customers to place an order, check its status, and review their invoice. And because the Microsoft® BackOffice® family is tightly integrated with IIS, the company can also easily tie the Web ordering application into their customer service, manufacturing and financial systems and realize real productiivty gains and savings.
INTEGRATION WITH MICROSOFT TRANSACTION SERVER
Microsoft Transaction Server (MTS), also part of Windows NT Server 4.0, handles many of the complexities of developing secure, scalable and reliable client/server and Web applications. It allows developers to focus on what is really important in a project--the business logic.
The result is shorter development time, less complex programming, and easier deployment and integration through:
Three-tier application model.
Transacted Active Server Pages.
Application services.
APPLICATION MODEL
Three-tiered applications separate presentation, business, and data logic. In the case of IIS, a Web browser invokes an ASP file on the Web server. The ASP file contains script that references components. These components contain the application, or business logic. Components run on the server, and can access and manipulate information from databases. They pass results back to the ASP file, which is then processed by the Web server and an HTML page is returned to the requesting browser.
MTS plays the role of coordinator in the middle layer, working with IIS to process client requests across components and databases that can be anywhere on the network. MTS allows developers the flexibility to deploy applications with the best design for their network, clients, and servers. Code can be run on any tier.
To date, businesses have had to purchase costly, high-end application platforms to enjoy the benefits of a three-tiered approach. MTS provides an accessible three-tiered model on Windows NT Server, delivering high-end distributed features at a much lower cost.
TRANSACTIONAL ACTIVE SERVER PAGES
Frequently business applications need to have the ability to run scripts and components within transactions. A transaction is a server operation that succeeds or fails as a whole, even if the operation involves many steps such as ordering, checking inventory, and billing. You can create ASP scripts that run within a transaction so that if any portion of the script fails, the entire transaction is aborted.
ASP transaction processing is based on MTS, which provides a run-time infrastructure for deploying and managing Web applications.
APPLICATION SERVICES
The functionality required to create transactional scripts is built into IIS. If you install MTS, you can also package components so they run within transactions. The benefits of MTS include:
 ActiveX language support. You build MTS applications as software components using tools that support ActiveX , including Microsoft Visual Basic®, Visual C++®, and Visual J++TM. This leverages existing investments in training, people, and the $240 million market for pre-built ActiveX components.
 Java 1.1 support. The Windows NT 4.0 Option Pack will support the new additions to the Java specification. These include, the JDBC to ODBC bridge, network and I/O enhancements, and others. This will provide developers with the latest and most up to date capabilities Java has to offer. ActiveX controls can now be able to be accessed as Java Beans (components), and Java Beans accessed as ActiveX controls. This integration is seamless, automatic, and bidirectional.
 Simple interfaces. Server environments like TP Monitors and Object Request Brokers require mastering hundreds of APIs before you become productive. C has only two main APIs, lowering training costs while improving developer productivity.
 Automatic thread and process management. MTS manages low-level system resources, enabling components to automatically operate in a multi-user environment without forcing you to build this complexity into your applications.
 Component packaging. MTS includes a component packaging service, so you do not have to wrestle with the complicated logistics of integrating, installing, and deploying many components as a single application.
 Shared property manager. MTS provides a mechanism that makes it easy to share data among multiple concurrently executing objects without forcing the developer to program complex state sharing and synchronization logic.
MESSAGE QUEUING
With the trend toward distributed computing in enterprise environments, it is important to have flexible and reliable communication among applications. Businesses often require independent applications that are running on different systems to communicate with each other and exchange messages even though the applications may not be running at the same time.
Microsoft® Message Queue Server (MSMQ), also part of Windows NT Server 4.0, technology enables applications running at different times to communicate across heterogeneous networks and systems that may be temporarily offline. Within an MSMQ enterprise, applications send messages to queues and read messages from queues.
MSMQ integration with IIS allows developers to send asynchronous messages from ASP (or a component invoked from ASP). Using ASP, a Web Application can send a MSMQ message to a remote source for deferred processing.
MSMQ fully supports the MTS transaction model - allowing developers to wrap the transmission and retrieval of MSMQ messages within an MTS transaction.
Using Transacted ASP, a Web Application can group the MSMQ message transmission with other transacted work (SQL updates, other MSMQ messages, etc). This greatly enhances developers' ability to build scalable fault tolerant applications on IIS.
ACCESSING DATA
Web applications must be able to easily and efficiently access diverse data sources. Through the Active X Data Objects and ODBC, IIS 4.0 provides you with simple and powerful interfaces to access information stored in a variety of relational database and non-database information stores on any platform.
ACTIVEX DATA OBJECTS(ADO)
ADO provides you with the fastest, easiest and most productive means for accessing all kinds of data sources. You can use ADO to create data-driven Web applications using ASP, or even use ADO within an ActiveX component to interact directly with a data source. The ADO model strives to expose everything that the underlying data provider can do, while still adding value by giving you shortcuts for common operations.
ADO is designed for enterprise-class deployment. ADO is part of a language-independent, component-based system for database access. Applications built with ADO can use the transaction support in IIS 4.0 to enable interoperability, and ensure a high degree of scalability and reliability. Because ADO works with OLE-DB providers, it can access a variety of data sources. Data sources include both traditional relational database management systems, and non-database sources such as file systems, spreadsheets, and full-text indexes.
ADO provides easy database connectivity. Because ADO simply extends existing Microsoft ODBC interfaces, C++ and Visual basic you do not have to learn new objects, methods, and syntax for Web development.
ADO can be easily optimized for different databases. Because ADO is used with Active Server Pages, the dynamic content and server-side scripting environment for IIS, you can write conditional scripts that execute different SQL commands based upon the ODBC driver being used. Applications can be customized for different customers without having to change the code.
ADO provides a scalable and reliable way to build database applications. Database applications created around ADO can use the integrated transaction processing features in IIS 4.0 to provide multi-user support and reliability through TP monitoring.
REMOTE DATA SERVICES (RDS)
RDS is a client-side technology that goes beyond the current generation of Web data access tools by allowing clients to update the data they see.
Using Dynamic HTML and data binding in Internet Explorer 4.0, developers can deploy sophisticated user interfaces that allow end users to view and change data with a minimum of programming. End users are no longer restricted to staring at a static HTML results table. With RDS, they may now alter, add, and delete data they have queried and retrieved without making round-trips to the server each time. All changes are buffered locally, and can be submitted to the server for final inspection, processing and storage in the database.
OPEN DATABASE CONNECTIVITY(ODBC)
ODBC provides an industry standard set of interfaces for communicating with over 55 data stores.
You can write database applications without targeting a single database vendor. Using ODBC gives you the flexibility of creating powerful database applications and business the choice of database server. ODBC gives you the flexibility of creating database applications in high performance languages like C++, or with scripting languages like JScript and VB Script. ODBC provides high performance database connectivity and is the native driver to several server databases. These include Microsoft SQL Server, IBM, and Informix databases. Regardless of whether or not ODBC is the native driver for a database has very little effect on performance.
HOST DATA INTEGRATION
Using Microsoft SNA Server 4.0, Web applications can reliably connect to AS400 and mainframe data.
OLE DB Provider for AS/400 and VSAM. This new technology provides record level access to VSAM files in the mainframe environment, and OS/400 Physical and Logical files.
COM Transaction Integrator for CICS and IMS. Integrates Microsoft MTS applications with CICS and IMS transactions. The Component Builder brings Microsoft drag-and-drop simplicity to developing MTS components from existing mainframe application programs, while the run-time components provide true integration, including distributed 2-phase commit between MTS and CICS applications. Since MTS is fully integrated with IIS, applications developed with this technology are created once, and can be used either by DCOM clients, Active Server Pages, or even SQL Server stored procedures.
BUILDING SCALABLE AND RELIABLE APPLICATIONS
IIS 4.0 protects the Web server and Web applications by running the components of applications in the MTS framework. This provides increased reliability and scalability
through:
Object brokering
Crash protection and recovery
Component management
ODBC Connection Pooling
Message Queuing
OBJECT BROKERING
Microsoft Transaction Server acts as a sort of a traffic director between Active Server Pages (ASP) and the components that make up a Web application. To improve performance and scalability, MTS uses a process called "just-in-time" (JIT) activation and "as-soon-as-possible" (ASAP) deactivation.
MTS deactivates an object when it is not in use by its client and yet allows its client to maintain a reference to it. In an environment where many clients are contesting for the same object, MTS will dole out a deactivated object before instantiating a new one. This improves performance and scalability because objects can be "warmed up" and ready to go, fewer server resources are used, and a greater number of clients can efficiently use a smaller number of components.
CRASH PROTECTION AND RECOVERY
Applications built with Active Server Pages (ASP) and the Internet Server API (ISAPI) for IIS 3.0 are fast. They achieve this by running in the same memory space as the IIS server and all other applications. While processing is faster, if one application causes a problem the entire server could potentially stop.
IIS 4.0 is able to run applications in their own memory space. However, unlike CGI applications which start a new process for request, MTS enables IIS to keep applications alive as long as new requests are coming in. This results in significantly better performance than CGI.
In the event a component crashes, the server and other applications stay running-only the single out of process application dies. IIS automatically restarts the application on the next request.
COMPONENT MANAGEMENT
When developing Web applications, it is often necessary to stop the application for debugging purposes or to load an updated version.
IIS 4.0 provides component management to stop an application without stopping the entire server. This unloads the application from memory so an administrator can install new components. The application restarts the next time a browser requests it.
ODBC CONNECTION POOLING
IIS 4.0 recycles ODBC connections in much the same way that it recycles connections to objects. Rather than discarding ODBC connections when they are no longer in use, MTS simply deactivates them and ultimately passes the connection out to another object in need.
New ODBC connections are only necessary when there are more active connections required than deactivated resources. Again, performance and scalability are greatly improved.
DEBUGGING
The Microsoft Script Debugger helps you interactively test your Web applications and quickly locate problems in the scripts
Regardless of your planning or level of experience, scripting errors may prevent your Active Server Pages applications from initially working correctly. Debugging, or the process of finding and correcting scripting errors, is crucial to the development of successful and robust Web applications.
The Microsoft Script Debugger is a powerful debugging tool that works with Windows Internet Explorer version 3.0 or later. It has several helpful and effective debugging features. You can:
 Run your server-side scripts one line at a time.
 View the values of your variables, properties, or array elements while your ASP script runs.
 Set pauses, with either the debugger or by inserting a statement into your scripts, to suspend execution of your server-side scripts at a particular line.
 Trace procedures and functions while running the ASP script.
IIS SOFTWARE DEVELOPMENT KIT (SDK)
IIS 4.0 includes a Software Development Kit to help developers understand the Web application programming services. The SDK provides developers with a number of examples in the following areas:
ASP examples. These are designed to give new users an overview of the capabilities of server-side scripting in general, and ASP pages in particular, while at the same time providing more advanced examples for experienced developers who want to discover what ASP can do for them.
Component eExamples. The IIS 4.0 SDK contains several examples that demonstrate key concepts in component construction.
There are several samples provided including source in Visual Basic, C++, and Java.
ISAPI examples. Using ISAPI, developers can add to the functionality of IIS, and create Web-based applications that have as much functionality as any desktop application. The IIS 4.0 SDK provides a number of ISAPI Extensions and Filters to demonstrate how to use the ISAPI interface.
|