RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.
When calling a web service from a .net client you may see a delay.
From Internet Explorer, it may take a couple of seconds for the request to complete but when calling the same web method from a .net client it takes an extra 20 seconds.
Proxy auto detection delay
Use one of the following methods:
Â
Method 1:  Turn off “Automatically Detect Settings†in Internet Explorer
Â
Method 2: Â Modify machine.config or app.config to disable .Net framework from using the autoproxy feature.
<configuration>
<system.net>
<defaultProxy >
<!-- Disable Autoproxy-->
<proxy autoDetect="false"/>
</defaultProxy>
</system.net>
</configuration>
The following article does an excellent job of explaining how proxy support works in .net framework:
Â
"Take the Burden Off Users with Automatic Configuration in .NET"
http://msdn.microsoft.com/en-us/magazine/cc300743.aspx
(http://msdn.microsoft.com/en-us/magazine/cc300743.aspx)
Â
Here is a snippet from the section titled "
Proxy Support in the .NET Framework 2.0" which explains the reason for the delay when the Autoproxy protocol is implemented:
"Automatic proxy configuration is now fully supported. The .NET Framework 2.0 reads the complete settings from the registry, including the automatic configuration flags and any explicitly provided script location. Automatic detection happens by first using the DHCPINFORM message and then using the DNS resolution techniques already described. Once the script location is identified, the script is
downloaded, compiled into an in-memory assembly, and then executed in a sandbox app domain where minimal permissions are granted.
Â
In fact, no code access security (CAS) permissions are granted to the script other than the execution permission. Minimal permissions mean that rogue scripts can't do anything significant other than call the few functions exposed to the script. For a detailed sample of how to host and run your own scripts in a sandbox app domain, see the sidebar, "Hosting the Proxy Script."
Â
Failover is also built in. If auto-detection fails and if you have entered an explicit script location, then that script is downloaded and run. If both fail and if you have a static proxy, then the static proxy is used as a fallback. If all fail, a direct connection to the target URL is attempted."
Â
So, all of the above happens when the registry key is examined and the value indicates “Automatically detect settingsâ€. The reason for the delay is the time it takes to do all of the above before trying
the direct connection.
Â
If you have to use a specific proxy server, specify it in code or config file through <defaultProxy> setting, which is documented in MSDN:
"<defaultProxy> Element (Network Settings)"
http://msdn.microsoft.com/en-us/library/kd3cf2ex(VS.80).aspx
(http://msdn.microsoft.com/en-us/library/kd3cf2ex(VS.80).aspx)
Â
For additional information, see the following:
Â
·        307220 HOW TO: Configure an XML Web Service Client by Using the .NET Framework to Work with a Proxy Server   Â
http://kbalertz.com/307220
(http://support.microsoft.com/default.aspx?scid=kb;en-us;307220)
Â
·        330221 PRB: Common Proxy Server and Firewall Issues with MapPoint Web Services
http://kbalertz.com/330221
(http://support.microsoft.com/default.aspx?scid=kb;en-us;330221)
Â
·        "Take the Burden Off Users with Automatic Configuration in .NET"
http://msdn.microsoft.com/en-us/magazine/cc300743.aspx
(http://msdn.microsoft.com/en-us/magazine/cc300743.aspx)
Â
Â
How to change the machine.config to disable the default proxy settingsHere is an example how you can change the machine.config to disable using the default settings for the proxy, and instead specify your own proxy settings:
<defaultProxy>
<proxy
usesystemdefault = "false"
proxyaddress="<http://proxyserver:port>"
bypassonlocal="true"
/>
<bypasslist>
<add address="100.100.100.100" />
</bypasslist>
</defaultProxy>
Â
You can, alternatively, set the proxy name and bypass list in code on the Proxy property on the web service object:
"WebProxy Class"
http://msdn.microsoft.com/en-us/library/system.net.webproxy(VS.80).aspx
(http://msdn.microsoft.com/en-us/library/system.net.webproxy(VS.80).aspx)
Â
Â
 Â
MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEBSITE (THE “MATERIALSâ€) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.