Microsoft KB Archive/826216

= FIX: Winhttp.dll Causes a Memory Leak When Windows Integrated Authentication Fails =

Article ID: 826216

Article Last Modified on 11/15/2007

-

APPLIES TO

 Microsoft SOAP Toolkit 3.0, when used with:  Microsoft Windows XP Professional

 Microsoft Windows 2000 Standard Edition 

-



SYMPTOMS
When you try to consume a Web service from a client that uses Microsoft SOAP 3.0, you may notice a memory leak.

Note You notice this behavior when you set the authentication scheme for your SOAP client object to Windows Integrated authentication by using the following code: objSoapClient.ConnectorProperty(&quot;WinHTTPAuthScheme&quot;) = 2 Note &quot;objSoapClient&quot; is the name of a SOAP client object.



CAUSE
The SOAP client object uses the Winhttp.dll component. If Windows Integrated authentication fails, a memory leak occurs in the Winhttp.dll component, and you notice the behavior that is mentioned in the &quot;Symptoms&quot; section.



RESOLUTION
A supported hotfix is now available from Microsoft. However, this hotfix is intended to correct only the problem that this article describes. Apply this hotfix only to systems that are experiencing this specific problem.

To resolve this problem, submit a request to Microsoft Online Customer Services to obtain the hotfix. To submit an online request to obtain the hotfix, visit the following Microsoft Web site:

http://go.microsoft.com/?linkid=6294451

Note If additional issues occur or any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. To create a separate service request, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

The English version of this has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

Microsoft Windows 2000 Operating Systems


Date        Time   Version            Size    File name --  27-Aug-2003  05:22  5.1.2600.1264     310,784  Winhttp.dll

Microsoft Windows XP Operating Systems
<pre class="fixed_text">

Date        Time   Version            Size    File name --  21-Aug-2003  05:46  5.1.2600.1264     945,152  Winhttp.dll

<div class="status_section">

STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

Steps to Reproduce the Behavior
<ol> Start Microsoft Visual Studio .NET.</li> On the File menu, point to New, and then click Project.</li> Click Visual Basic Projects or Visual C# Projects under Project Types, and then click ASP.NET Web Service under Templates.</li> Name the project SampleWebService .</li> In the Service1.asmx file, uncomment the HelloWorld Web service method.</li> On the Build menu, click Build Solution.</li> Click Start, and then click Run.</li> Type inetmgr in the Open box, and then click OK.</li> In the Internet Information Services window, expand Default Web Site.</li> Right-click SampleWebService, and then click Properties.</li> In the SampleWebService Properties dialog box, click the Directory Security tab.</li> Under Anonymous access and authentication control, click Edit.</li> In the Authentication Methods dialog box, click to select the Integrated Windows authentication check box.

Note Make sure that all the other check boxes in the Authentication Methods dialog box are cleared.</li> Click OK two times to close the SampleWebService Properties dialog box.</li> Close the Internet Information Services window.</li> Start Microsoft Visual Basic 6.0.</li> <li>Create a Standard EXE project. By default, Form1 is created.</li> <li>Add a CommandButton control and a ProgressBar control to Form1. If the toolbox does not contain the ProgressBar control, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>On the Project menu, click Components.</li> <li>Click to select Microsoft Windows Common Controls 6.0.

Note If the Controls tab of the Components dialog box does not contain Microsoft Windows Common Controls 6.0, click Browse, click MSCOMCTL.OCX, and then click Open.</li> <li>Click OK to close the Components dialog box.</li></ol> </li> <li> In the click event of the Command1 control, paste the following code: Dim objSoapClient As Object Dim wsdl As String Dim MySoapResponse As String Dim i As Long

' The wsdl variable contains the physical path of the wsdl in the client. wsdl = &quot;C:\SoapClient\SoapTestSrv.wsdl&quot; Set objSoapClient = CreateObject(&quot;Mssoap.SoapClient30&quot;) objSoapClient.MSSoapInit wsdl

' The value of AuthUser/AuthPassword must be incorrect for a memory leak to occur. objSoapClient.ConnectorProperty(&quot;AuthUser&quot;) = &quot;TestUserid&quot; objSoapClient.ConnectorProperty(&quot;AuthPassword&quot;) = &quot;TestPassword&quot; objSoapClient.ConnectorProperty(&quot;WinHTTPAuthScheme&quot;) = 2

' Replace ServerName with the name of the server where the Web service Service1.asmx is hosted. objSoapClient.ConnectorProperty(&quot;EndPointURL&quot;) = &quot;http://ServerName/SampleWebService/Service1.asmx&quot;

For i = 1 To 500000 On Error Resume Next On Error GoTo Error MySoapResponse = objSoapClient.HelloWorld

'If you run this code, you will notice a memory leak. If (i Mod 500000) = 0 Then ProgressBar1.Value = ProgressBar1.Value + 1 End If

Error: MsgBox (Err.Description) Next

Set objSoapClient = Nothing </li> <li>On the Run menu, click Start. Form1 is displayed.</li> <li>On Form1, click Command1.</li></ol>

Note You notice this behavior in any application that uses the Winhttp.dll component and that also uses Windows Integrated authentication.

<div class="references_section">