WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML...

44
WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation

Transcript of WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML...

Page 1: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

WEB307

Web Services Deployment, Configuration & Versioning

Richard TurnerProgram ManagerXML Enterprise ServicesMicrosoft Corporation

Page 2: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Contents

DeploymentXCOPYMSIThird Party ToolsSDC Build & Deployment ToolPublishing Web Services

Configuration.NET ConfigurationConfig FilesDBMS Config

Versioning.NET VersioningWeb Services VersioningRemoting VersioningDatabase Versioning

Page 3: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Deployment

Distribution of components, content and configuration

Essential to keep as an atomic unitAutomatic deployment is nirvana

Several tools / techniques:XCOPYMSI Installer

Build-in Visual Studio.NET Setup ProjectsThird Party tools

Domain specific toolsRemember to test!

Page 4: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

XCOPY Deployment

Can be very quick and very simple

May require scriptingTo configure environment

To create & configure platform, eg:VRoots

Folders

Mailboxes

IIS doesn’t need to be restarted Great for automated deployments

Page 5: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

MSI Based Installations

Microsoft Installer technology built into Windows

Provides transacted, atomic deployment and configuration of applications

Corrupted installations can be repaired

Broad industry supportInstallation Builders

Deployment Tools

Page 6: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

VS.NET Setup Projects

Visual Studio.NET includes several setup projects:

Setup

Web Setup

Merge Module

CAB

The Wizard will guide you

Great for Quick ‘n’ dirty deployments

Moderate levels of control

Page 7: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Third Party Installer Tools

Third party tools are an important consideration

Packaging & Web DeploymentInstallShield

Wise

ZeroG

Many tools provide powerful featuresScriptable & customizable engine

Visual Studio integration

Cross-platform support

Page 8: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Deployment Tools

Content Management & DeliveryMicrosoft Content Management Server

Vignette

Interwoven

DeploymentMicrosoft SMS

Tivoli

Zero G

Altiris

ManageSoft

Page 9: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

SDC Build & Deployment Tool

Developed by Microsoft’s Solution Development Center

Used to build significant real-world solutionsCombines 3 services: Build, Packaging and DeploymentBuild:

Controlled through an XML makefilePowerful and flexible – can build Windows apps, Websites, WebServices, etc.

PackagingAll deployable resources packaged into MSI files

Page 10: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

SDC Build & Deployment Tool

DeploymentDeployment engine instantiated by MSI installer and is driven by XML deployment fileSupports creation of:

IIS VRootsFolders & ACL’sSQL DatabasesBizTalk provisioningEnterprise Services / COM+ ComponentsWindows ServicesEtc…

Support for more technologies on the way

Page 11: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

SDC Build & Deployment Tool

Tool available publicly at:http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=2cb20e79-d706-4706-9ea0-26188257ee7d

Full source code available for your own customizationNo formal supportMay need modifications for your needs or environment

Page 12: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Publishing Web Services

Who will use your Web Service?

How and where will they find it?

UDDI, WS_Inspection and WSDL can help!Defined by Microsoft, IBM, Ariba and others

Submitted to standards bodies for ratification

Gaining broad industry support

WSDL likely to become the Web Services equivalent of IDL + + + + + + + + !!!+ + + + + + + + !!!

Page 13: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Web Service Discovery

UDDIFederated Web Services meta-data directoryPowerful search & query capabilitiesIncluded in Windows 2003 ServerAvailable on many platforms from a number of vendors

WSDLDetailed type, interface and protocol spec’s for Web ServicesInherent within .NET

WS_INSPECTIONEnumerate Web Services within a machine / environmentRequires implementation at present …

Page 14: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Database Deployment

Many ways to deploy DatabasesDepends on facilities offered by DBMS’ vendor

Microsoft SQL Server has a comprehensive range of options:

Write your own script in TSQL or SQL-DMO

Generate DB Script from existing DB

Database export & import wizards (schema + data)

Replication

Backup and restore elsewhere

Detach files and re-attach elsewhere

Explore your DBMS’ facilities

Page 15: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Deployment Process

Reliable, repeatable deployment can be hard to achieve!Plan your deployment story in detailTest several times before final deploymentTest again and again and again …Test on different hardware & environmentsEffective testing is exponentially more important when upgrading a running system!Plan for when things go wrong

Because they usually do!!!!!Practice makes perfect!

Page 16: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Configuration

Considering:.NET, ASPX config

Platform

Data tier

Page 17: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

.NET Configuration

.NET is configured through XML configuration files:machine.config

holds machine-wide config settingsweb.config

holds config information for ASP.NET web sites and web services

app.exe.configConfiguration for .NET applications

Config files are manipulated through:Manual intervention Script / codeTools

Page 18: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

machine.config

Found in:%windir%\Microsoft.NET\Framework\v1.x.yyyy\config\machine.config

Provides a great deal of control over .NET & ASP.NET engine, including:

CPU affinity

Worker process & thread characteristics

Request limits

Process user identity

Page 19: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Web Services configured via XML web.config file:

<?xml version="1.0"?><configuration>

<system.web><compilation … /><customErrors … /><authentication … /><authorization … /><trace … /><sessionState … /><globalization … />

</system.web></configuration>

Web Service Configuration

HeaderHeader

FooterFooter

Configuration Configuration SectionsSections(small selection)(small selection)

Page 20: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Configuring for Availability

What happens when your app crashes, hangs or eats the whole machine?

For IIS5.x, consider the <processModel> element in machine.config

Configuring Memory limits, thread limits etc. can help your applications!

For IIS6, use the IIS configuration console<processModel> is ignored!

Page 21: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Configuring for Security

How do you secure your Web Service?

Web.config contains key security settingsAuthentication methods including:

Anonymous, Basic, Windows, Certificate, Kerberos, Forms

Authorization for Users & Roles, eg:<authorization> <allow verb="GET" users="*" /> <allow verb="POST" users="Mary" /> <deny verb="POST" users="*" /> </authorization>

Page 22: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Extending Configuration

Consider storing app specific config in custom sections:<appSettings> <add key=“dbConnStr" value=“database=Sales;user=…"/></appSettings>

Create a Configuration Section Handler which implements the following interface:namespace System.Web.Configuration { public interface IConfigurationSectionHandler { public Object Create(Object parent,

Object input,XmlNode node);

}}

Page 23: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Data Tier Configuration

Most DBMS’ have powerful configuration capabilities

Microsoft SQL Server configurable through: 1170 system Stored Procedures

SQL Distributed Management Objects (SQL-DMO)

Consider implementing a config tool or script for your project:

Repeatability is key!

Page 24: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Versioning

Goodbye “DLL Hell”!

Versioning is inherent to .NETAssembly Versioning

Remoting Versioning

No technological versioning story for Web Services!

But there are still ways ;)

Requires careful planningBuild versioning into your designs

Make careful decisions around encoding etc.

Page 25: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

.NET Assembly Versioning

.NET versions at the Assembly levelMajor.minor.build.revision

Eg: .NET Frameworks 1.1 = 1.1.4322.573

All assemblies are version checked by the CLR loader if strongly named

Versions can be coerced through config files:<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

<dependentAssembly><assemblyIdentity name="MarineCtrl"

publicKeyToken="9335a2124541cfb9" /> <bindingRedirect oldVersion=“1.1.34.2"

newVersion=“1.7.98.5" /> </dependentAssembly>

</assemblyBinding>

Page 26: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

File & Assembly Versioning

Files and assemblies can be versioned independentlyThe <AssemblyVersion> attribute defines the assembly’s version that CLR binds againstThe <AssemblyFileVersion> updates the file version stringWhen should I update version numbers?

For pre-ship builds: Keep assembly versions the same between builds, but update the file version infoFor shipped product: Increment the build only if your new Assembly changes it’s semantics or risks breaking existing code. Otherwise, just rev the revision

Only update major or minor when big changes occurUpdate your version numbers during your build process

Try to avoid the “1.2.*” wildcard mechanism … can introduce uncertainty!

Page 27: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Web Service Versioning

Web Services do not support full .NET versioning mechanisms externally

Since versioning is not a Web Service technology

Key goal is to extend a type over time without breaking existing consumers

Several Web Service versioning techniques

Page 28: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Namespace Versioning

Implemented through URI’sDate Encoded:http://foo.org/2003/05/23/Invoice/Invoice.asmxVersion Encoded:http://foo.org/v2.0.4822.2/Invoice/Invoice.asmx

Familiar to anyone who navigates the W3C spec’sQuick, simple and dirty versioning strategyBut … plagued by problems:

Each new “version” invisible to existing clients without redirectionEven with redirection, existing clients validate messages against XSD which is now differentNew namespace != new versionNew namespace == new elements & types

Recommend Namespace Versioning not be used … unless you can accept breaking downlevel clients

Page 29: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

So what do I do?

Bear with us we’re working on solving this in the future ;)

Until then, there are several versioning techniques:

Loosely typed fields

Optional elements

User parsed datatypes

Essentially, consider making your web services version-flexible!

Requires that you learn to lve XSD!

Page 30: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Loosely Typed Fields

Specify methods accepting parameters of “object” typepublic string AddSale(

[XmlElement(Namespace="http://sales")]object sale) {...}

Map these properties to XSD elements<schema xmlns="http://www.w3.org/2001/XMLSchema"

targetNamespace="http://sales"><element name="sale" type="anyType"/>

</schema>

Up to the application to then parse the data accordinglyThe parameters’ data is not implicitly validated against schema

Page 31: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Optional Elements

Useful when extending existing typesDoes not break existing consumersInherently validated against XSDEg, V1:<schema targetNamespace="http://sales" xmlns="..." > <element name=“sale"> <complexType name=“sale"> <sequence>

<element name=“customerName" type="string"/> </sequence> </complexType> </element></schema>

[XmlType(Namespace="http://people")]public class Sale {

public string customerName;}

Page 32: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Optional Elements (cont…)

V2:<schema targetNamespace="http://sales" xmlns="..." > <element name=“sale"> <complexType name=“sale"> <sequence>

<element name=“customerName" type="string"/><element name=“itemCount" type="int" minOccurs="0"/>

</sequence> </complexType> </element></schema>

[XmlType(Namespace="http://people")]public class Person {

public string customerName;public int itemCount;

[XmlIgnore()]public bool itemCountSpecified;

}

V2 aware code sets V2 aware code sets this …this …

… … and the serializer and the serializer writes thiswrites this

Serializer sees that this field Serializer sees that this field exists and sets this to trueexists and sets this to true

V2 aware code reads this V2 aware code reads this and acts accordinglyand acts accordingly

Page 33: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Open Content Types

Consider Open Content Model for types that are highly dynamic in structure

<schema targetNamespace="http://people" xmlns="..."> <element name="person"> <complexType> <xs:sequence>

<xs:any processContents="lax" maxOccurs="unbounded“ minOccurs=“0” />

</xs:sequence> <xs:anyAttribute processContents="lax"/> <attribute name="version" type="string" use="required"/>

</complexType> </element></schema>

Can still specify structured elements within such structuresUse property bags for open extensibility

Page 34: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Open Content Usage

When deserialized, elements that do not exist as fields in the object are collected into an array which can be processed accordingly…// Deserialize the class.Object x = mySerializer.Deserialize(fs);

// Read the element names and values.foreach(XmlElement xel in x.AllElements)

Console.WriteLine(xel.LocalName + ": " + xel.Value);

Page 35: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Open Content Versioning

Use the “version” tag defined in the schema to make versioning decisionspublic string AddSale

([XmlElement(Namespace="http://sales")] Sale sale)

{switch (sale.version) {

case "1.0": return DoAddSale(sale);default: return DoAddSaleV2(sale);

}}

VERY loosely typed, but still as type-safe as can be!!

Page 36: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Versioning & Remoting

Server Activated Objects (SAO):Server controls which version is activatedIf no version info sent from client, latest version is instantiatedVersion can be coerced via config file:

<service> <wellknown mode="SingleCall“

type="Hello.HelloService,MyHello,Version=1.0.0.0, [strong name]"

objectUri="HelloService.soap" /> <activated type="Hello.AddService, MyHello“ /> </service>

Client Activated Objects (CAO):Client controls which version is activated by the serverServer must activate version of the assembly that the client app was built againstCannot coerce the version number at the server

Page 37: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

More remoting & versioning

Object references follow the same rules as for SAO’s and CAO’s

The object reference carries version info, but the previous rules are maintained

Object Marshalled By Value (MBV) only includes version info if:

BinaryFormatter is used

SoapFormatter + config declaration is specified:

<formatter ref="soap" includeVersions="true" />

Page 38: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Database Versioning

This is VERY hard to do!

Usually involves a data manipulation and migration process

Customizing a replicated version at a point in time is a good solution

Requires EXTENSIVE testing

Expect (& plan for) downtime

Often requires duplicate hardware rig

Avoid if possible through careful DB design at the outset!

Page 39: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Suggested Reading And Resources

Visit the Microsoft Press Kiosk today to receive Visit the Microsoft Press Kiosk today to receive 40%40% off books off books purchased from Amazon.compurchased from Amazon.com

Microsoft Press books are available at the TechEd Bookstore Microsoft Press books are available at the TechEd Bookstore and also at the Ask the Experts area in the Expo Halland also at the Ask the Experts area in the Expo Hall

The tools you need to put technology to work!The tools you need to put technology to work!

TITLETITLE AvailableAvailable PricePrice

Building XML Web Services for Building XML Web Services for the Microsoft .NET Platformthe Microsoft .NET Platform

Scott Short Scott Short

TodayToday $59.99$59.99

Page 40: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Additional Reading And Resources

The tools you need to put technology to work!The tools you need to put technology to work!

TITLETITLE AvailableAvailable PricePrice

TodayToday $49.99$49.99

.NET Web Services: Architecture .NET Web Services: Architecture and Implementation with .NETand Implementation with .NET

Keith Ballinger Keith Ballinger

Essential .NET, Volume I: The Essential .NET, Volume I: The Common Language RuntimeCommon Language Runtime

Don BoxDon Box

TodayToday $49.99$49.99

Page 41: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Community Resources

Community Resourceshttp://www.microsoft.com/communities/default.mspx

Most Valuable Professional (MVP)http://www.mvp.support.microsoft.com/

NewsgroupsConverse online with Microsoft Newsgroups, including Worldwidehttp://www.microsoft.com/communities/newsgroups/default.mspx

User GroupsMeet and learn with your peershttp://www.microsoft.com/communities/usergroups/default.mspx

Page 42: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

evaluationsevaluations

Page 43: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

Conclusion

There is no single silver bullet today for versioning or deployment

But we’re working on it ;)

Consider a toolset that suits your needs

.NET Provides very powerful deployment, configuration & versioning facilities

But plan carefully

Aim for automation – helps ensure reliable & repeatable deployments

Test test and test again!

And when you think you’ve tested enough …… Test again, just to make sure

Page 44: WEB307 Web Services Deployment, Configuration & Versioning Richard Turner Program Manager XML Enterprise Services Microsoft Corporation.

© 2003 Microsoft Corporation. All rights reserved.© 2003 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.