dev332 programming for the middle tier in visual basic.net billy hollis author / consultant
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 ServicesTRANSCRIPT
DEV332Programming for the Middle Tier in Visual Basic .NET
Billy HollisAuthor / Consultant
Agenda
Typical architectural elements in the middle tierWeb Services basics (briefly)Windows servicesPerformance countersEvent logsMessage queues
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
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
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
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
Data Web ServicesData Web Services
demodemo
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
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
Creating A Windows ServiceGreat for non-UI, long-running functionality
MonitoringScheduled ActivityRemoting Host
Respond to eventsTimer tickMessage queue receiveDirectory/file changeEvent log write
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
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
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
Creating Windows ServicesCreating Windows Services
demodemo
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
Controlling Windows Controlling Windows ServicesServices
demodemo
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
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
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
Performance Counters and Performance Counters and Message QueuesMessage Queues
demodemo
Ask The ExpertsGet Your Questions Answered
Billy will be in the Ask the Experts booth Wednesday afternoon from 2:00 to 4:00
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
evaluationsevaluations
© 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.