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
![Page 1: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/1.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/2.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/3.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/4.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/5.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/6.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/7.jpg)
Data Web ServicesData Web Services
demodemo
![Page 8: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/8.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/9.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/10.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/11.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/12.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/13.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/14.jpg)
Creating Windows ServicesCreating Windows Services
demodemo
![Page 15: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/15.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/16.jpg)
Controlling Windows Controlling Windows ServicesServices
demodemo
![Page 17: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/17.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/18.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/19.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/20.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/21.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/22.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/23.jpg)
evaluationsevaluations
![Page 24: DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant](https://reader035.vdocument.in/reader035/viewer/2022062906/5a4d1b2e7f8b9ab059999f47/html5/thumbnails/24.jpg)
© 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.