windows server 2008 for devsdownload.microsoft.com/documents/uk/msdn/events/mp_win... ·...

42
for Developers Martin Parry Developer and Platform Group Microsoft [email protected] http://martinparry.com

Upload: others

Post on 12-Jul-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

for Developers

Martin ParryDeveloper and Platform GroupMicrosoft

[email protected]://martinparry.com

Page 2: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

Agenda

Top 7 Ways To “Light Up” Your Apps on Windows Server 2008

Part 1 emphasis on

IIS7, PowerShell

Part 2 emphasis on

WER, Restart and Recovery APIs, TxF

Page 3: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

The Top 7 Ways… Part 1

1. Build More Flexible Web Applications

2. Design Highly-Manageable Applications

3. Develop Federation-Aware Applications

4. Build Connected Systems

5. Build For Scalability

6. Virtualize

7. Develop More Reliable Applications

Page 4: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

1. Build More Flexible Web Apps

Page 5: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS 7.0 Introduction

Client version shipped with Windows Vista

Limited throughput

Server version will ship with WS2008

Currently available in RC form

More features than client

Page 7: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS 7.0 Architecture

Page 8: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

Windows Process Activation Service

Manages configurationWhat used to be the metabase

Responsible for starting worker processes...w3wp.exe

...and routing incoming requests to the appropriate worker process

Also hosts the new listener adapter interfaceYou can build your own listeners for WAS

Page 9: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS 6.0 Request Pipeline

Page 10: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS 6.0 Request Pipeline

IIS pipeline extensible using ISAPINative code

Can apply to all requests

ASP.NET pipeline extensible using IHttpModuleManaged code

Can only apply to requests routed via ASP.NET

Certain pipeline elements are “always there”IIS authentication

Logging

Page 11: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS 7.0 Request Pipeline

Page 12: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS 7.0 Request Pipeline

Linear sequence of modules

Any module can be enabled/disabledIncluding “built-in” ones

Modules can be managed or native code

Any type of module applies to any request

Page 13: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS7 Modules

Page 14: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS 6.0 Configuration

IIS 6.0 (and earlier) use the metabase

Stores all configuration information

Originally in binary form, then in XML

Hard to allow management of separate apps by different groups of people

Page 15: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS 7.0 Configuration

machine.config

“root” web.config

web.config

web.config

web.config

applicationHost.config

Page 16: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS7 Configuration

Page 17: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

Building Native Modules

Export a RegisterModule function from DLL

Define one or more other functions

To process request or response

Inside RegisterModule...

Hook up your other functions(s) at specific points in the pipeline

E.g. Begin, AuthN, AuthZ, ExecuteHandler, End

Page 18: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

Building Managed Modules

Implement IHttpModule

Implement Init function

Attach event handlers for specific points in the pipeline

E.g. Begin, AuthN, AuthZ, ExecuteHandler, End

Same as existing ASP.NET HttpModules

Page 19: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS7 Managed Module

Page 20: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS7 Diagnostics - RSCA

Runtime Status and Control API

Shows currently executing: -

Application Pools

Requests

Exposed via

IIS admin tool

Programmatically via WMI and Managed OM

Page 21: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS7 Diagnostics – Failed Requests

IIS7 allows you to log trace information just for requests that fail

For some definition of failure

Buffers all trace output

Only flushes to disk if the request fails

Log output is XML, with a stylesheet

Breaks down processing by module

Includes timing details for each module

Page 22: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS7 – Failed Request Tracing

Enable FREB at the Web Site level

Configure FREB rules at the application level

Each rule: -

Specifies the type of web content it applies to

Can specify a specific failure code

Can specify a duration in seconds

Can specify a trace event severity

Page 23: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

IIS7 Failed Request Tracing

Page 24: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

2. Design Highly-Manageable Apps

Page 25: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

Management in Windows Server 2008

MMC v3.0

Managed framework for building snap-ins

Microsoft.ManagementConsole namespace

– Ships with .NET Framework v3.0

Already seen it in use – IIS Admin Console

Windows PowerShell

Page 26: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

Windows PowerShell

It’s a command-line interface!ScriptableCommands may be composedNot based on text, based on .NET objectsAvailable for...

Windows XPWindows Server 2003Windows Vista

Ships inside...Windows Server 2008

Page 27: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

Windows PowerShell and Scripting

Page 28: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

PowerShell and Developers

Developers can create new commands

...and can create PowerShell “drives”

Excellent way to provide admin experience for your applications.

Exchange 2007 and SQL Server 2008, for example

Page 29: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

PowerShell Cmdlets and Providers

Page 30: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

3. Develop Federation-Aware Apps

Page 31: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

Developing Federated Identity Apps

With AD FSActive Directory Federation Services

Why?Enables cross-domain, cross-platform access to your Web applicationsProvides Web SSO experiencePromotes a claims-based programming modelAchieve reach for your application

– Think “outside of the firewall”

Page 32: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

`

Internal Client

Resource

Federation Server

Account

Federation Server

Web Server

Active Directory

A. Datum

Account Forest

Trey Research

Resource Forest

B2B Federation Scenario

Federation Trust

https

https

https

Page 33: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

Application Authorization Using Claims

ClaimsStatements made by an authority about a userUsed for authorization purposes

Three types of ADFS claimsIdentity

– Email– User Principal Name (UPN)– Common Name

GroupCustom

Identity

UPN:[email protected]

Group

PurchaserAdministratorAdatum

Custom

DisplayName:Eric Parkinson

Position:Purchasing Staff

Page 34: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

Coding a Federation-Aware app

System.Web.Security.SingleSignOn

System.Web.Security.SingleSignOn.Authorization

In code: -

SsoId = User.Identity as SingleSignOnIdentity

SsoId.IsAuthenticated – have we a good security token?

SsoId.SecurityPropertyCollection – each item could be...– Group claim, UPN claim, custom claim

Application can get any/all claim details

Page 35: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

4. Build Connected Systems

Page 36: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

Interopwith otherplatforms

ASMX

Attribute-Based

Programming

Enterprise Services

WS-*ProtocolSupport

WSE

Message-Oriented

Programming

System.Messaging

ExtensibilityLocation transparency

.NET Remoting

Windows Communication Foundation

Page 37: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

Sub-queuesPoison Message

Handling

App-Specific

Dead Letter Queues

Transactional

Remote Receive

MSMQ 4.0

Page 38: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

Sub-queues

Never created explicitly

Accessed via DIRECT FormatName...

DIRECT=OS:server\private$\myqueue;mysubq

Created at time of first Open

Can receive in the normal fashion

Can only insert with MQMoveMessage

No managed code equivalent

Page 39: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

Poison Message Handling

WCF binding configuration...<netMsmqBinding>

<binding name="PoisonBinding" receiveRetryCount="0“maxRetryCycles="1“retryCycleDelay="00:00:05“receiveErrorHandling="Move"></binding>

</netMsmqBinding>

Page 40: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

End of Part One

Build More Flexible Web Applications

IIS7

Design Highly-Manageable Applications

Windows PowerShell, MMC3

Develop Federation-Aware Applications

AD FS

Build Connected Systems

WCF, MSMQ 4

Page 41: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

MSDN in the UK

Visit http://msdn.co.uk

Newsletter

Events

Screencasts

Blogs

Page 42: Windows Server 2008 for Devsdownload.microsoft.com/documents/uk/msdn/events/MP_Win... · 2018-12-05 · IIS7 Diagnostics –Failed Requests IIS7 allows you to log trace information

© 2007 Microsoft Ltd. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market

conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.

MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.