I think some things here need clearing up.
The ProgID "Microsoft.XMLHTTP" points at the same class as "MSXML2.XMLHTTP". This class uses the WinINET HTTP protocol stack that Internet Explorer uses and therefore will use whatever proxy configuration is found in the Internet Settings on the PC.
Hence for "Microsoft.XMLHTTP" the proxycfg command is not useful.
An alternative to XMLHTTP is "MSXML2.ServerXMLHTTP". This class uses the WinHTTP HTTP protocol stack which is designed to be lightweight and server friendly. It is safe to use multiple instances in multiple threads in the same process where WinINET isn't. For this reason it is ServerXMLHTTP should be used in server-side ASP code.
WinHTTP does not use the Internet Settings that WinINET uses, hence to configure the proxy that ServerXMLHTTP will use you need to use the proxycfg command. A really useful command is:-
proxycfg -u
Which copies the current WinINET proxy settings to those used by WinHTTP, if you use tools like fiddler this is useful to start monitoring traffic going through WinHTTP after fiddler is started. (Note you follow up with proxycfg -d
to remove the proxy settings).
ServerXMLHTTP also has a setProxy
method which allows the actual proxy settings to be configured dynamically be code.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…