Jeff Sanders Technical Blog

I am a Microsoft employee that has worked on all aspects of the Web Stack for a long time. I hope these blogs are useful to you! Use this information at your own risk.


Earlier Posts

This article is a great help http://support.microsoft.com/kb/915599 however, there is another potential cause.  If the target server resets the connection without replying with an HTTP status (for example 200 OK) you can also get this error.  Solution, find out why the server is reseting the connection.  Common causes include the target of the HTTP traffic is not handling exceptions and crashing, forcing the web server to recycle that process (app pool for IIS) and this sends the TCP RST.


If you are making Synchronous calls in WinInet, the DNS timeouts don’t appear to work when set (see: http://support.microsoft.com/kb/263558 ).


WinDbg is a powerful tool and can use the SOS extension (that ships with the .NET framework) to look into and analyze Managed Code.  Another powerful tool is Debug Diagnostics.  It uses the same Debugger Engine that WinDbg uses and can run analysis scripts.  You can use Debug Diagnostics and a custom script to analyze hangs and performance issues with the HttpWebRequest class.

I will walk you through some techniques that will allow you to customize your own Debug Diagnostics script to analyze .NET HttpWebRequest connection saturation.

The technique I will use is to:

1.       Walk the threads in a Dump and look for Managed threads that have System.Net.HttpWebRequest.GetResponse on the stack.  To me that means we are waiting on a response and may indicate an issue.

2.       For each of the threads found above, I will get the ServicePoint object and see how many connections it allows vs.  how many it currently has.

3.       Make a suggestion on how to fix it!

DebugDiag (Debug Diagnostics) has a great help file and some starter scripts.  I wanted to use jscript so the starter scripts did not do much for me since they were written in VBScript.  I put all the metadata for the script on one line so that when I get script errors I can easily map this to the script I am editing in Visual Studio 2008.  Save the script (with a .asp extension) to the Scripts sub-directory of where DebugDiag is installed and it will show up when you start DebugDiag.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 

Here is the starting script:


Quickie post…


I had an issue where someone wanted to stream a file that was generated on the web server and prevent it from caching on the client.  The correct way to do this is to specify the Cache-Control: no-cache header.  When this was done however the pdf file did not display using https and on Windows XP.  After some research the method that worked for this scenario was to define an OBJECT tag and point the SRC attribute to the page that generates the file on the fly.


**Your get one of these errors when running Internet Explorer:
** Stop running this script?
A script on this page is causing Internet Explorer to run slowly.
If it continues to run, your computer might become unresponsive.


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />


In the spirit of my post: <a class=”” title=”How To: Close the Form hosting the WebBrowser control when scripting calls window.close in the .Net Framework version 2.0” href=”http://blogs.msdn.com/jpsanders/archive/2007/05/25/how-to-close-the-form-hosting-the-webbrowser-control-when-scripting-calls-window-close-in-the-net-framework-version-2-0.aspx” target=_blank mce_href=”http://blogs.msdn.com/jpsanders/archive/2007/05/25/how-to-close-the-form-hosting-the-webbrowser-control-when-scripting-calls-window-close-in-the-net-framework-version-2-0.aspx”>How To: Close the Form hosting the WebBrowser control when scripting calls window.close in the .Net Framework version 2.0</a> the .NET 2.0 WebBrowser control has no control over the close events like WindowClosing.  One valid solution is to use the ActiveX version of the WebBrowser control.  Currently the .NET 2.0 WebBrowser contol simply wraps the ActiveX version anyhow!


An embedded WMP or Flash movie would not start when Internet Explorer loaded this page:


I have a web page that has a global variable in the jscript called xmlhttp.  It is the build in XMLHttp object in Internet Explorer.  I am hosting the WebBrowser control in a C# (.NET managed code) application and I want to know when the XMLHttp object is done.  This occurs after the document complete event so how do I do this?


**UPDATE: Replace ATLServer with WWSAPI! **<font color=#000000>**Windows Web Services API Client code walkthrough**</font>** **

 

 

When I tried to build an old ATLServer WebClient SOAP project I got these errors:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

fatal error C1083: Cannot open include file: ‘atlsrvres.h’: No such file or directory

fatal error RC1015: cannot open include file ‘atlsrvres.h’

 

Download the latest ATLServer code from http://www.codeplex.com/AtlServer and unzip it on the build machine.

 

Set the resource and C++ include paths of your project to point to the include folder location from the unzipped codeplex code.

 

Rebuild.


The following vb Script can fail with an “Access is denied” error message: