Download presentation
Presentation is loading. Please wait.
Published byBlaze Wheeler Modified over 8 years ago
1
DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant
2
Agenda Typical architectural elements in the middle tier Web Services basics (briefly) Windows services Performance counters Event logs Message queues
3
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
4
Designing Web Services Group related operations and data into one method Decide on: Interface and return data Security Use output caching to improve performance Define your input and output data structures using XSD schemas Separate XML Web service from underlying business logic
5
XML Web Services Mapping Data Schema Services InvocationWebXML XSD WSDL SOAP ApplicationConceptsFrameworkObjects Classes Methods Calls The.NET Framework provides a bi-directional mapping
6
Returning Data From An XML Web Service SQL Server Customers DataAdapter XML Web service DataSet IIS Oracle Orders XML DataSet Generic Client.NET Client DataAdapter
7
Data Web Services demo demo
8
Binary Data Web services are not limited to textual data – images, sound files, etc Return as bytes with Base64 stream Use WS-Attachments (DIME) Direct Internet Messaging Encapsulation Available using WSE toolkit or in Visual Studio.NET 2003 Can use over TCP, other protocols
9
Web Services vs. Remoting Web Services are easier to create and configure Web Services can be accessed by non.NET systems Remoting faster and easier to secure Remoting offers true exceptions Decision point – if you control both ends, remoting is usually the better choice
10
Creating A Windows Service Great for non-UI, long-running functionality Monitoring Scheduled Activity Remoting Host Respond to events Timer tick Message queue receive Directory/file change Event log write
11
Installing Windows Services Can run under different security context LocalSystem requires no login Install using command line utility installutil.exe [projectname.exe] Uninstall using installutil.exe /u [projectname.exe] Custom installer
12
Service Events Inherits from System.ServiceProcess.ServiceBase Override event methods: MethodBehavior OnStartSet action for when service is started (thirty seconds maximum!) OnPauseSet action for when service is paused OnStopSet action for when service is stopped OnContinueSet action for when service is resumed from pause OnShutDownSet action for when system is shutting down OnCustomCommandSet action for a custom command OnPowerEventSet action for low battery/suspend
13
Debugging Windows Services F5 debuggging not available Service must be deployed and installed Attach to the Service’s process Still set breakpoints for events Have all errors/exceptions logged to Windows Event Log
14
Creating Windows Services demo demo
15
Service Controller Service Controller class allows you to stop, start, pause or obtain information about windows services Namespace: System.ServiceProcess.ServiceController Can only communicate via custom numeric commands
16
Controlling Windows Services demo demo
17
Performance Counters Per Application Performance Counters Enable easily monitoring of individual applications Custom Performance Counters APIs Now possible to publish unique application- specific performance data Great for real-time application monitoring Example: total orders, orders/sec
18
Event Logs Indispensable in the middle tier Log errors and activity Drag and drop programming Can monitor event log with a Windows Service Take action Record event to database
19
Message Queue Enables you to connect to, monitor, send/receive/peek and administer message queues Loosely coupled programming MessageQueue Class Send/receive/peek messages in the queue Message Class Construct for the message Namespace: System.Messaging
20
Performance Counters and Message Queues demo demo
21
Ask The Experts Get Your Questions Answered Billy will be in the Ask the Experts booth Wednesday afternoon from 2:00 to 4:00
22
Community Resources http://www.microsoft.com/communities/default.mspx Most Valuable Professional (MVP) http://www.mvp.support.microsoft.com/ Newsgroups Converse online with Microsoft Newsgroups, including Worldwide http://www.microsoft.com/communities/newsgroups/default.mspx User Groups Meet and learn with your peers http://www.microsoft.com/communities/usergroups/default.mspx
23
evaluations evaluations
24
© 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.