Visual Basic 6'0 WebClasses Support issues and best practices J'D' Meier Developer Support Engineer - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

Visual Basic 6'0 WebClasses Support issues and best practices J'D' Meier Developer Support Engineer

Description:

What about Active Server Pages (ASP)? What problems do WebClasses solve? Security issues ... Target server needs Posting Acceptor correctly installed ... – PowerPoint PPT presentation

Number of Views:99
Avg rating:3.0/5.0
Slides: 29
Provided by: bre2
Category:

less

Transcript and Presenter's Notes

Title: Visual Basic 6'0 WebClasses Support issues and best practices J'D' Meier Developer Support Engineer


1
Visual Basic 6.0 WebClassesSupport issues and
best practices J.D. MeierDeveloper Support
EngineerASP Product LiaisonMicrosoft Corporation
2
Todays Topics
  • In a nutshell
  • What about Active Server Pages (ASP)?
  • What problems do WebClasses solve?
  • Security issues
  • Threading issues
  • State management

3
More Topics
  • Deployment
  • Scalability
  • Performance tuning
  • Resources

4
In a Nutshell
  • COM components running under ASP/IIS
  • Bound to the ASP TypeLib
  • A framework for leveraging existing Microsoft
    Visual Basic (VB) knowledge in an Internet
    environment

5
What About ASP?
  • 10 threads per processor
  • Threading issues
  • Security context
  • InProc vs. object oriented programming (OOP)
    (isolated process)

6
What Problems Do WebClasses Solve?
  • Leverage existing VB knowledge
  • Add an event model to an otherwise synchronous
    environment
  • Increase performance
  • Win32 application programming interface (API) is
    accessible

7
Security Primer (1)
  • Authentication methods
  • Windows NT Challenge/Response (Windows NT LAN
    Manager NTLM)
  • Great for your intranet!
  • Not supported by Netscape Navigator
  • Access limited to local machine and
    non-authenticated protocols (sockets)
  • Basic authentication
  • Supported by Netscape Navigator
  • Access not limited to local machine
  • Account information transferred in clear-text
    (Base64 encoded) across the wire
  • Allow Anonymous

8
Security Primer (2)
  • Application settings determine your thread's
    security context
  • In processSYSTEM impersonates authenticated
    account
  • Out of processIWAM_ltmachinegt impersonates
    authenticated account

9
Security Issues
  • Access Denied (local and remote resources)
  • Works during design, fails in production
  • Desktop issues

10
Troubleshooting Security (1)
  • Who am I?
  • Set authentication method to Basic
  • Use GetUserName() API
  • Windows NT? Registry Monitor (RegMon)
  • Windows NT File Monitor (FileMon)
  • Enable auditing

11
Troubleshooting Security (2)
  • GetUserName() API
  • Private Declare Function GetUserName Lib
    "advapi32.dll _
  • Alias "GetUserNameA" (ByVal lpBuffer As String, _
  • nSize As Long) As Long
  • Public Function WhoAmI() As String
  • Dim strBuff As String
  • Dim lngConst As Long
  • Dim lngRet As Long
  • Dim strName As String
  • lngConst CLng(199)
  • strBuff Space(200)
  • lngRet GetUserNameA(strBuff, lngConst)
  • WhoAmI Trim(Left(strBuff, lngConst))
  • End Function

12
Troubleshooting Security (3)
  • Windows NT? RegMon and FileMon
  • Available for free at http//www.sysinternals.com
  • Enable Auditing
  • Log all resource accesses to the Event Log

13
Threading Primer
  • ASP has 10 threads per processor allocated by
    default
  • MTS manages threads
  • Page-scoped STA objects perform best
  • Do not store STA objects in Session object

14
Threading COMplications (1)
  • VB objects
  • Support STA
  • Calls are serialized
  • Do not store in Session object
  • Avoid global data

15
Threading COMplications (2)
  • Running under IIS means multiple client threads
  • Debug mode can be misleading
  • Single-thread executing during debug
  • Different security context during run-time

16
Threading Issues
  • Apartment model objects in Session contribute to
    the following problems
  • Application doesn't perform past N users
  • Application seems to hang
  • Users corrupt each other's data
  • Removing objects from Session solves the majority
    of the above problems

17
Troubleshooting Threading Issues
  • Turn off ASP server-side debugging
  • IDE is not a good test
  • PerfMon
  • ASP Requests Executing
  • ASP Requests Queued
  • GetCurrentThreadId() API

18
GetCurrentThreadId() API
  • Private Declare Function GetCurrentThreadId _
  • Lib "kernel32" () As Long
  • Public Function GetThreadId() As Long
  • GetThreadId GetCurrentThreadId()
  • End Function

19
State Management
  • Implications of a statefull WebClass
  • The WebClass is stored in Session
  • Limits scalability
  • The best way to reduce performance
  • Locks the Session to a specific thread

20
Safer State Management
  • Database
  • Cookies
  • URLData

21
Deployment
  • Package and Deployment Wizard has problems
  • Read the Readme
  • Virtual directory needs to exist
  • Target server needs Posting Acceptor correctly
    installed
  • Multiple versions of the Posting Acceptor

22
Deployment in the Real World
  • Create a standard setup
  • Manual method
  • Create a dependency list
  • Manually register each file
  • Key files
  • VB 6 run-time
  • WebClass run-time
  • Your project.dll
  • Other project dependencies

23
Scalability Issues
  • Paradigm shift from desktop to server
  • Acquire resources late and release them early
  • Pool db connections (ODBC connection pooling with
    ADO)
  • Avoid storing objects in Session
  • IIS must ensure that the same thread services
    each request associated with the session
  • Defeats the purpose of having a thread pool
  • Design stateless WebClasses

24
Performance Tuning (1)
  • Project properties
  • Unattended Execution
  • Retain in Memory
  • Set TagPrefix property to empty string
  • Specify string name in URLFor methods, not the
    object reference
  • Minimize the use of templates

25
Performance Tuning (2)
  • Response.Write is faster than a template
  • Lost the flexibility of templates
  • Avoid run-time parsing of templates by setting
    TagPrefix and URLData to null
  • Move business logic out of WebClasses and into
    MTS objects

26
General Troubleshooting
  • Network Monitor
  • Trace HTTP Traffic
  • WebCat
  • Stress test for performance
  • PerfMon
  • Watch ASP and IIS counters

27
Resources
  • Microsoft Visual Basic? docs
  • Choose Index and type WebClasses
  • Knowledge Base
  • kbWebClasses
  • VB 6 Readme
  • MSDN? feature
  • http//msdn.microsoft.com/vbasic

28
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com