Specifies which proxy to use to transfer files.
HRESULT SetProxySettings( BG_JOB_PROXY_USAGE ProxyUsage, const WCHAR *ProxyList, const WCHAR *ProxyBypassList );
Specifies whether to use the user's proxy settings, not to use a proxy, or to use application-specified proxy settings. The default is to use the user's proxy settings, BG_JOB_PROXY_USAGE_PRECONFIG. For a list of proxy options, see the BG_JOB_PROXY_USAGE enumeration.
This method returns the following HRESULT values, as well as others.
||Proxy was successfully specified.|
||The value for ProxyUsage is not defined in the BG_JOB_PROXY_USAGE enumeration.|
||The pProxyList buffer cannot exceed 32 KB.|
||The pProxyBypassList cannot exceed 32 KB.|
||The state of the job cannot be BG_JOB_STATE_CANCELLED or BG_JOB_STATE_ACKNOWLEDGED.|
||The pProxyList parameter cannot be NULL if ProxyUsage is BG_JOB_PROXY_USAGE_OVERRIDE.|
The proxy information you provide is validated at run time. If the proxy information is invalid, the job enters the BG_JOB_STATE_ERROR state with a BG_E_INVALID_PROXY_INFO error code.
If your service runs as LocalSystem, you should use the SetProxySettings method to explicitly specify a proxy or proxy bypass list for the account and set ProxyUsage to BG_JOB_PROXY_USAGE_OVERRIDE. For more information on using system accounts with BITS, see Service Accounts and BITS.
BITS does not recognize the proxy settings that are set using the Proxycfg.exe file.
Specify a proxy as:
The valid protocols are HTTP and HTTPS. The proxy list can contain the port number that is used to access the proxy. For example, to list an HTTP proxy, a valid string is "http=http://http_proxy_name:80", where http_proxy_name is the name of the proxy server and 80 is the port number that you must use to access the proxy. If the proxy uses the default port number for that protocol, then you can omit the port number. If a proxy name is listed by itself, you can use it as the default proxy for any protocols that do not have a specified proxy. For example, "http=http://http_proxyother_proxy" uses http_proxy for any HTTP operations, while the HTTPS protocol uses the proxy named other_proxy.
You can list locally known host names or Internet Protocol (IP) addresses in the proxy bypass list. This name can contain wildcards, such as "", that cause the application to bypass the proxy server for addresses that fit the specified pattern, for example, ".microsoft.com" or ".org". Wildcard characters must be the left-most characters in the name. For example, "aaa." is not supported. You can specify the <local> macro to indicate that all local intranet sites are bypassed. Local intranet sites are considered to be all servers that do not contain a period in their name.
BITS uses the Internet Explorer proxy settings of the user if an application does not specify a proxy usage. This default behavior typically works if the application submits the job in the context of an interactive user but may not work if a service running as LocalSystem submits the job. You can specify Internet Explorer proxy settings for LocalSystem; however, it is difficult to detect these settings when problems occur.
|Windows version||Windows XP Windows Server 2003|