Microsoft KB Archive/307220

= HOW TO: Configure an XML Web Service Client by Using the .NET Framework to Work with a Proxy Server =

Article ID: 307220

Article Last Modified on 7/31/2003

-

APPLIES TO


 * Microsoft Web Services Enhancements for Microsoft .NET 2.0
 * Microsoft Proxy Server 2.0 Standard Edition

-



This article was previously published under Q307220





IN THIS TASK
SUMMARY
 * Requirements
 * Configure the HTTP Proxy Settings for Desktop and ASP.NET Applications

REFERENCES



SUMMARY
This step-by-step article describes how to allow an XML Web service client application that is built with the .NET runtime to connect to a service through a Hypertext Transfer Protocol (HTTP) proxy server.

back to the top

Requirements
The following items describe the recommended hardware, software, network infrastructure, skills and knowledge, and service packs that you need:
 * XML
 * HTTP proxy concepts

back to the top

Configure the HTTP Proxy Settings for Desktop and ASP.NET Applications
Generally, the .NET runtime uses the default proxy settings that have been set for Microsoft Internet Explorer when it is used from a standard desktop application. If you can browse to the Web site where your Web service is located, you can make calls with the .NET runtime without making a change because your settings are retrieved from where they are stored in your user profile.

The .NET runtime does not, however, support automatic proxy discovery scripts. If Internet Explorer uses the automatic configuration options to determine the HTTP proxy settings, you can manually configure the global HTTP proxy settings in the Machine.config file. Likewise, if you are using the .NET runtime to access an XML Web service in a situation in which a user profile is not loaded (for example, if you call an XML Web service from an ASP.NET page), you must configure the computer settings in the Machine.config file.

To configure the HTTP proxy settings for desktop and ASP.NET applications, follow these steps:  Edit the Machine.config file. For the .NET Framework, the default location for this file is C:\WINNT\Microsoft .NET\Framework\v1.0.2914\CONFIG\machine.config. Locate the \configuration\system.net\defaultProxy element in the XML.  Change the child  element to the following, where http:// indicates your HTTP proxy server:  The bypassonlocal attribute indicates that requests to hosts whose names contain a period (.) should not be sent through the proxy.   If other addresses need to bypass the proxy server, you can add them by creating a  element as a child of the  element. The <bypasslist> syntax should resemble the following: <add address=&quot;localdomain.com|localdomain2.com&quot; /> This syntax avoids sending any requests to localdomain.com and localdomain2.com through the HTTP proxy. The address attribute is actually a string that contains a regular expression. For more information on the syntax of regular expressions, see the information on System.Text.RegularExpresions in the .NET runtime documentation. </li> Save the changes to Machine.config and restart the application.</li></ol>

back to the top

<div class="references_section">