dev332 programming for the middle tier in visual basic.net billy hollis author / consultant

24
DEV332 Programming for the Middle Tier in Visual Basic .NET Billy Hollis Author / Consultant

Upload: blaze-wheeler

Post on 18-Jan-2018

215 views

Category:

Documents


0 download

DESCRIPTION

Typical Architecture Elements Web Service Façade Remoting Façade (Windows Service) Business rules (Operations with no connection) Data Access Layer (all connected operations) Message Queues Windows Services Remote Web Services

TRANSCRIPT

Page 1: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

DEV332Programming for the Middle Tier in Visual Basic .NET

Billy HollisAuthor / Consultant

Page 2: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Agenda

Typical architectural elements in the middle tierWeb Services basics (briefly)Windows servicesPerformance countersEvent logsMessage queues

Page 3: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Typical Architecture ElementsWeb Service Façade Remoting Façade

(Windows Service)

Business rules(Operations with no connection)

Data Access Layer(all connected operations)

MessageQueues

WindowsServices

Remote Web Services

Page 4: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Designing Web ServicesGroup related operations and data into one methodDecide on:

Interface and return dataSecurity

Use output caching to improve performanceDefine your input and output data structures using XSD schemasSeparate XML Web service from underlying business logic

Page 5: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

XML Web Services Mapping

DataData

SchemaSchema

ServicesServices

InvocationInvocation

WebWeb

XMLXML

XSDXSD

WSDLWSDL

SOAPSOAP

ApplicationApplicationConceptsConcepts FrameworkFramework

ObjectsObjects

ClassesClasses

MethodsMethods

CallsCalls

The .NET Framework providesThe .NET Framework providesa bi-directional mappinga bi-directional mapping

Page 6: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Returning Data From An XML Web Service

SQL ServerSQL Server

CustomersCustomersDataAdapterDataAdapterXML WebXML Web

serviceservice

DataSetDataSet

IISIIS

OracleOracle

OrdersOrders

XMLXML

DataSetDataSet

Generic ClientGeneric Client

.NET Client.NET Client

DataAdapterDataAdapter

Page 7: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Data Web ServicesData Web Services

demodemo

Page 8: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Binary Data

Web services are not limited to textual data – images, sound files, etcReturn as bytes with Base64 streamUse WS-Attachments (DIME)

Direct Internet Messaging EncapsulationAvailable using WSE toolkit or in Visual Studio .NET 2003Can use over TCP, other protocols

Page 9: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Web Services vs. Remoting

Web Services are easier to create and configureWeb Services can be accessed by non .NET systemsRemoting faster and easier to secureRemoting offers true exceptions

Decision point – if you control both ends, remoting is usually the better choice

Page 10: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Creating A Windows ServiceGreat for non-UI, long-running functionality

MonitoringScheduled ActivityRemoting Host

Respond to eventsTimer tickMessage queue receiveDirectory/file changeEvent log write

Page 11: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Installing Windows Services

Can run under different security contextLocalSystem requires no login

Install using command line utilityinstallutil.exe [projectname.exe]Uninstall usinginstallutil.exe /u [projectname.exe]Custom installer

Page 12: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Service EventsInherits from System.ServiceProcess.ServiceBaseOverride event methods:

Method BehaviorOnStart Set action for when service is started

(thirty seconds maximum!)OnPause Set action for when service is pausedOnStop Set action for when service is stoppedOnContinue Set action for when service is resumed from

pauseOnShutDown Set action for when system is shutting downOnCustomCommand Set action for a custom commandOnPowerEvent Set action for low battery/suspend

Page 13: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Debugging Windows Services

F5 debuggging not availableService must be deployed and installedAttach to the Service’s process

Still set breakpoints for events

Have all errors/exceptions logged to Windows Event Log

Page 14: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Creating Windows ServicesCreating Windows Services

demodemo

Page 15: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Service ControllerService Controller class allows you to stop, start, pause or obtain information about windows servicesNamespace: System.ServiceProcess.ServiceControllerCan only communicate via custom numeric commands

Page 16: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Controlling Windows Controlling Windows ServicesServices

demodemo

Page 17: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Performance CountersPer Application Performance Counters

Enable easily monitoring of individual applications

Custom Performance Counters APIsNow possible to publish unique application-specific performance data Great for real-time application monitoringExample: total orders, orders/sec

Page 18: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Event Logs

Indispensable in the middle tierLog errors and activityDrag and drop programmingCan monitor event log with a Windows Service

Take actionRecord event to database

Page 19: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Message QueueEnables you to connect to, monitor, send/receive/peek and administer message queues Loosely coupled programmingMessageQueue Class

Send/receive/peek messages in the queue

Message ClassConstruct for the message

Namespace: System.Messaging

Page 20: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Performance Counters and Performance Counters and Message QueuesMessage Queues

demodemo

Page 21: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

Ask The ExpertsGet Your Questions Answered

Billy will be in the Ask the Experts booth Wednesday afternoon from 2:00 to 4:00

Page 22: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

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 23: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

evaluationsevaluations

Page 24: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant

© 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.