Microsoft KB Archive/273496

= PRB: IIS 5.0 Stops Responding When You Call Application.Lock and Application.Unlock in WebClasses =

Article ID: 273496

Article Last Modified on 7/15/2004

-

APPLIES TO


 * Microsoft Internet Information Services 5.0
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q273496



SYMPTOMS
When you debug a Visual Basic WebClass application within the Visual Basic Integrated Developer Environment (IDE) on a Microsoft Windows 2000-based computer, and you call the Application.Lock and Application.UnLock methods, the Web server may stop responding (hang).



CAUSE
With the introduction of COM+, Internet Information Server (IIS) 5.0 takes advantage of the Thread-Neutral Apartment (NA) when you access the Application object. As a result, when you explicitly call Application.Lock and Application.UnLock from a component, you encounter a deadlock scenario that causes the server to stop responding under certain situations.



RESOLUTION
Do not use Application.Lock and Application.UnLock in your WebClass code when you debug.



Steps to Reproduce Behavior
 Start Visual Basic. In the New Project dialog box, select IIS Application, and then click Open. In the Project window, click to expand the Designers folder. Right-click WebClass1, and then click View Code from the shortcut menu.  Add the following code to the WebClass_OnStart event: Application.Lock Application(&quot;myvar&quot;) = &quot;hello world&quot; Application.UnLock  Save the WebClass. On the Debug menu, click Start to run the WebClass. Internet Explorer stops responding, and the page is never displayed in the browser.</ol>

<div class="references_section">