Presentation is loading. Please wait.

Presentation is loading. Please wait.

IIS7 The Future of Microsoft’s Web Server Platform.

Similar presentations


Presentation on theme: "IIS7 The Future of Microsoft’s Web Server Platform."— Presentation transcript:

1 IIS7 The Future of Microsoft’s Web Server Platform

2 Agenda Handlers and Modules IIS UI Extending the IIS Schema Tracing and Diagnostics Configuration Overview Integrated Configuration Delegation of Configuration Configuration Extensibility

3 IIS7 – Built for Extensibility Handlers and Modules Role and Membership Providers Extending the IIS Schema IIS UI Tracing and Diagnostics

4 IIS6 Request Processing Monolithic implementation Install a aa all or nothing… ISAPI Extend server functionality only through ISAPI… PHPPHP AuthenticationAuthentication DetermineHandlerDetermineHandler NTLMNTLMBasicBasicAnonAnon CGICGI StaticFileStaticFile ISAPIISAPI Send Response LogLogCompressCompress … … ASP.NETASP.NET

5 Handlers vs Modules Modules provide services to all requests Basic Authentication module Compression module (etc) Handlers provide services to specific extensions ISAPI handler (.dll) Static handler (.htm,.jpg,.gif, etc) IIS 7 pipeline allows native and managed modules and handlers "Integrated" Application Pool mode Use the managed modules and handlers "Classic" Application Pool IIS 6 style invocation of.NET

6 IIS7 Request Processing Send Response DetermineHandlerDetermineHandler AuthenticationAuthentication SendResponseSendResponse AuthenticationAuthentication Authorization ResolveCache ExecuteHandlerExecuteHandler UpdateCache … … modules Server functionality is split into ~ 40 modules... Modules plug into a generic request pipeline… extend server functionality Modules extend server functionality through a public module API. … … LogLogCompressCompress NTLMNTLMBasicBasic CGICGI Static File ISAPIISAPI AnonAnon

7 Creating a Managed Module Identical to ASP.NET IHttpModule interface. How to: Create class to implement iHttpModule Write code for the Init Method Initialize module Subscribe to events Write code for the subscribed events Implement the Dispose method (required)Dispose Register the module in the Web.config or Applicationhost.config file.

8 Creating a Class from IHttpModule public class BasicAuthenticationModule : System.Web.IHttpModule { void Init(HttpApplication context) { } void Dispose() { } }

9 Integrated pipeline: Events Request Events Begin Authenticate Authorize Resolve Cache Map Handler Acquire State PreExecute Handler Execute Handler Release State Update Cache Log End On Demand Events SendResponse ReadEntityBody MapPath System.Web.Security. FormsAuthenticationModule BasicAuthenticationModuleBasicAuthenticationModule WindowsAuthenticationModuleWindowsAuthenticationModule UrlAuthorizationModuleUrlAuthorizationModule Global Events Initialize / Shutdown Config Change / File Change Application Start / Stop Health Check Trace Event More

10 Subscribing to an Event public void Init(HttpApplication context) { // // Subscribe to the authenticate event to perform the // authentication. // context.AuthenticateRequest += new EventHandler(this.AuthenticateUser); // // Subscribe to the EndRequest event to issue the // challenge if necessary. // context.EndRequest += new EventHandler(this.IssueAuthenticationChallenge); }

11 Add module to IIS 7 configuration Modules can be added to: Applicationhost.config as Global Applicaitonhost.config as Local with location tag Web.config The specific sequence of modules can matter Add modules with: IIS Manager APPCMD WMI Powershell Microsoft.web.administration

12 Modules in Applicationhost.config In Applicatonhost.config: - for native modules and Managed Engine - Entries for all native and managed modules preCondition tells managed modules to work only for managed code by default List is customizable per application and can be delegated Modules defined in Applicationhost.config load for all application unless in “location” tag.

13 Modules in Web.config Note System.webServer rather than System.web IIS 7 reads System.webServer, ASP.net reads System.web Delegation for managed most managed modules is enabled by default Native modules cannot be loaded in web.config

14 Options for Code Placement If loaded in Applicationhost.config: Compile and place managed code in GAC Can then service all requests in the server pipeline Native modules/handlers in system32\inetsrv Specify location in configuration In Web.config GAC Locally in \App_Code as uncompiled code Locally \bin as.dll If locally stored, Xcopy deployment will insure correct code and configuration

15 Creating a Managed Module

16 Creating a Managed Handler Identical to ASP.NET IHttpHandler Steps: Create Class that implements iHttpHandler Add code for ProcessRequest method This method receives a parameter of type HttpContext. Allows you to access the intrinsic objects such as Request and Response Set property IsReusable Determines if other request can use the handler Configure Handler in Applicationhost.config or web.config

17 Examining a Custom Managed Handler

18 Extending the IIS Manager UI IIS 6 MMC was not easy to extend IIS 7 Manager (IISMGR) has a modular design Add new controls, remove, or hide features Administration.config is xml config store IIS Manager features are Winform apps Integrate your application configuration into IISManager and IIS 7 confiig system

19 Extending the IIS 7 Schema Add app config settings to IIS 7 schema Add xml file to %SystemDir%\inetsrv\config\schema Automatically incorporated by IIS 7 Read with Microsoft.Web.Administration

20 Extending the IIS Manager

21 Add Tracing Events to Modules Integrate your apps with IIS 7 tracing Emit trace events that are logged in IIS trace logs Shows your modules events timestamped and in sequence with other pipleline events Quickly diagnose hangups, bottlenecks Can also add events in ASP.NET code

22 Add Trace Events to Modules

23 Configuration Overview New configuration system Before: System for a server Now: System for a platform IIS 7 uses ASP.NET style grammar and syntax File based config: No intervening service Root file for central record Child files for setting properties at the site or app level Rich API support means easier to manage Rich extensibility means easier to integrate Even the IIS UI is modular and extensible

24 Introduction to IIS 7 Configuration

25 IIS7 Configuration System Root Web.config ASP.net global ApplicationHost.config IIS7 Global and Location settings Web.config Per Application.NETFramework.NETFramework ASP.NETASP.NET IIS7IIS7 IIS + ASP.NET +.NET Framework IIS + ASP.NET +.NET Framework ASP.NET +.NET Framework ASP.NET +.NET Framework Machine.config NET global

26 Integration Unifying technologies Across technologies Same file and format for IIS, ASP.NET, WCF and third parties Across features Settings like authentication are set in a single place Same API concepts and tool usage across platform

27 IIS7 ASP.NET Integration Classic Mode Runs as ISAPI Integrated Mode.NET modules / handlers plug directly into pipeline Process all requests Full runtime fidelity LogLog CompressCompress BasicBasic Static File ISAPIISAPI AnonAnon SendResponseSendResponse AuthenticationAuthentication Authorization ResolveCache ExecuteHandlerExecuteHandler UpdateCache … … AuthenticationAuthentication FormsForms WindowsWindows Map Handler ASPXASPX TraceTrace …… … … aspnet_isapi.dl l

28 Delegation Distributing Configuration Administrators: control global and specific settings. Controls delegation Site operators: modify settings for their site/app – if permitted Developers: store app settings with website config to enable Xcopy- deployment of applications Locking permits granular control of config

29

30 Locking Non-administrators can modify/override properties. A special internal section: Schema-related information that can be edited. Registration point for adding sections. Attributes: overrideMode: Defines the lockdown state of a configuration section. ...

overrideModeDefault="Allow" />...

31 Locking

32 allowOverride="Allow” Delegation Control with Location allowOverride="Allow” Use to specifically permit delegated control Allows changes in Applicationhost & web.config for the section

33 allowOverride=“Deny” Delegation Control with Location allowOverride=“Deny” Use to centralize configuration control Can Deny specific paths and Allow others Permits changes for location only in Applicationhost.config

34 Using the Location Tag

35 Granular Locking Unlocking a section opens up the whole section for site/application owners to change. Granular locking can restrict specific elements or attribute settings from being added, edited or removed. Directives lockAttributes lockAllAttributesExcept lockElements lockAllElementsExcept lockItem

36 Granular Locking

37 IIS 7 Schema Declarative schema that defines the configuration properties and its logical groupings. Different from IIS 6 and ASP.NET. Specifies structure as well as names, types and default values for settings of the section. Files IIS_schema.xml ASPNET_schema.xml FX_schema.xml optional custom schema.xml Extensible

38 A configuration section Schema Its corresponding schema ......

39 Reading the Schema Schema definition for defaultDocument Shows rules for configuration in applicationhost.config Attribute “Enabled” is Boolean with default of True Files Element Collection for add, clear, remove, mergeAppend You can read the Schema for rules, options, and defaults

40 Extending the Schema Store application config with IIS settings to simplify site deployment IIS 7 Schema located in inetsrv\config Extend Schema by adding custom XML schema files to the config folder Will automatically be added to the IIS 7 Schema Application can read schema settings using Managed API

41 Summary Custom modules and handlers Extend reach of existing.NET handlers and modules to non ASP.NET content Extend UI / Schema: integrated administration Manage with granular delegated administration Diagnose with built in / extensible tracing

42


Download ppt "IIS7 The Future of Microsoft’s Web Server Platform."

Similar presentations


Ads by Google