I'm using Microsoft.XMLHTTP from a classic asp page to post info to another site...
我正在使用来自经典asp页面的Microsoft.XMLHTTP将信息发布到另一个站点......
I'd like to be able to inspect what's going on with fiddler, and to do so I have to find a way to configure Microsoft.XMLHTTP to use a proxy...
我希望能够检查fiddler发生了什么,为此我必须找到一种方法来配置Microsoft.XMLHTTP以使用代理...
is it possible? where does Microsoft.XMLHTTP gets its configuration from?
可能吗? Microsoft.XMLHTTP从哪里获取配置?
thanks a lot
非常感谢
4 个解决方案
#1
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.
ProgID“Microsoft.XMLHTTP”指向与“MSXML2.XMLHTTP”相同的类。此类使用Internet Explorer使用的WinINET HTTP协议堆栈,因此将使用PC上Internet设置中的任何代理配置。
Hence for "Microsoft.XMLHTTP" the proxycfg command is not useful.
因此,对于“Microsoft.XMLHTTP”,proxycfg命令没有用。
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.
XMLHTTP的替代方案是“MSXML2.ServerXMLHTTP”。此类使用WinHTTP HTTP协议栈,该协议栈设计为轻量级且服务器友好。在WinINET不在的同一进程中,在多个线程中使用多个实例是安全的。因此,ServerXMLHTTP应该用在服务器端的ASP代码中。
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:-
WinHTTP不使用WinINET使用的Internet设置,因此要配置ServerXMLHTTP将使用您需要使用proxycfg命令的代理。一个非常有用的命令是: -
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).
它将当前的WinINET代理设置复制到WinHTTP使用的设置,如果你使用像fiddler这样的工具,这对于在fiddler启动后开始监控通过WinHTTP的流量非常有用。 (请注意,您使用proxycfg -d跟进以删除代理设置)。
ServerXMLHTTP also has a setProxy
method which allows the actual proxy settings to be configured dynamically be code.
ServerXMLHTTP还有一个setProxy方法,它允许动态配置实际代理设置为代码。
#2
For windows Vista and above, the proxycfg.exe may have been deprecated, and replaced by netsh winhttp. As mentioned in this article: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384069%28v=vs.85%29.aspx
对于Windows Vista及更高版本,可能已弃用proxycfg.exe,并替换为netsh winhttp。如本文所述:http://msdn.microsoft.com/en-us/library/windows/desktop/aa384069%28v=vs.85%29.aspx
As my situation in win7, I need to do following to set proxy:
作为我在win7中的情况,我需要做以下设置代理:
netsh winhttp set proxy myProxyServer:80
#3
oops
I think I found it
我想我找到了
http://support.microsoft.com/kb/289481/EN-US/
you have to issu something like
你必须发布类似的东西
proxycfg -d -p myProxyServer:80 "<local>"
...
edit:
I've also found that using ServerXMLHTTP instead of XMLHttp, you have a setProxy method...
我还发现使用ServerXMLHTTP而不是XMLHttp,你有一个setProxy方法...
http://msdn.microsoft.com/en-us/library/ms760236(VS.85).aspx
and here is a usage example
这是一个用法示例
http://msdn.microsoft.com/en-us/library/ms763680(VS.85).aspx
...
#4
I looked at this thread to solve my issue - it helped but there are changes to newer systems now.
My situation was making a web MSXML2.ServerXMLHTTP Call from a corporate server going through Proxy Server with digested Active Directory Credentials.
我看了这个线程来解决我的问题 - 它有所帮助,但现在有更新的系统。我的情况是从公司服务器进行Web MSXML2.ServerXMLHTTP调用,通过代理服务器使用已消化的Active Directory凭据。
There were a couple issues here for me, but I eventually managed to get it to work with just the Standard MSXML2.ServerXMLHTTP without having to specify the .3.0 or .6.0 versions.
这里有几个问题,但我最终设法让它只使用标准MSXML2.ServerXMLHTTP,而不必指定.3.0或.6.0版本。
Newer windows servers do not have proxycfg, you need to use netsh as mentioned earlier.
较新的Windows服务器没有proxycfg,您需要使用前面提到的netsh。
There are a few things you need lined up.
In my scenario I was running the Website and Application Pool under the credentials of the AD User Account (This was required for database access) I would suggest that at least the Application Pool would need to run as the AD Account
你需要排列一些东西。在我的场景中,我使用AD用户帐户的凭据运行网站和应用程序池(这是数据库访问所必需的)我建议至少应用程序池需要作为AD帐户运行
This was on a 64 Bit Windows System
这是在64位Windows系统上
- Obviously the AD User will need to have internet access
- You will need to specify the winhttp proxy settings using netsh
- If you have 'Enable 32 bit Applications' Enabled you will also need to set the winhttp proxy for 32 bit. It will look for that setting.
显然,AD用户需要访问互联网
您需要使用netsh指定winhttp代理设置
如果启用了“启用32位应用程序”,则还需要将winhttp代理设置为32位。它会寻找那个设置。
So how?
Check winhttp proxy settings At the Command Line
检查winhttp代理设置在命令行
%WINDIR%\System32\NETSH WINHTTP SHOW PROXY
Check winhttp proxy settings At the Command Line
检查winhttp代理设置在命令行
%WINDIR%\SysWOW64\NETSH WINHTTP SHOW PROXY
If you need to set them From the Command Line [change 8080 to your port]
如果需要从命令行设置它们[将8080更改为您的端口]
%WINDIR%\System32\NETSH WINHTTP SET PROXY PROXYSERVERURL:8080
%WINDIR%\SysWOW64\NETSH WINHTTP SET PROXY PROXYSERVERURL:8080
#1
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.
ProgID“Microsoft.XMLHTTP”指向与“MSXML2.XMLHTTP”相同的类。此类使用Internet Explorer使用的WinINET HTTP协议堆栈,因此将使用PC上Internet设置中的任何代理配置。
Hence for "Microsoft.XMLHTTP" the proxycfg command is not useful.
因此,对于“Microsoft.XMLHTTP”,proxycfg命令没有用。
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.
XMLHTTP的替代方案是“MSXML2.ServerXMLHTTP”。此类使用WinHTTP HTTP协议栈,该协议栈设计为轻量级且服务器友好。在WinINET不在的同一进程中,在多个线程中使用多个实例是安全的。因此,ServerXMLHTTP应该用在服务器端的ASP代码中。
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:-
WinHTTP不使用WinINET使用的Internet设置,因此要配置ServerXMLHTTP将使用您需要使用proxycfg命令的代理。一个非常有用的命令是: -
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).
它将当前的WinINET代理设置复制到WinHTTP使用的设置,如果你使用像fiddler这样的工具,这对于在fiddler启动后开始监控通过WinHTTP的流量非常有用。 (请注意,您使用proxycfg -d跟进以删除代理设置)。
ServerXMLHTTP also has a setProxy
method which allows the actual proxy settings to be configured dynamically be code.
ServerXMLHTTP还有一个setProxy方法,它允许动态配置实际代理设置为代码。
#2
For windows Vista and above, the proxycfg.exe may have been deprecated, and replaced by netsh winhttp. As mentioned in this article: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384069%28v=vs.85%29.aspx
对于Windows Vista及更高版本,可能已弃用proxycfg.exe,并替换为netsh winhttp。如本文所述:http://msdn.microsoft.com/en-us/library/windows/desktop/aa384069%28v=vs.85%29.aspx
As my situation in win7, I need to do following to set proxy:
作为我在win7中的情况,我需要做以下设置代理:
netsh winhttp set proxy myProxyServer:80
#3
oops
I think I found it
我想我找到了
http://support.microsoft.com/kb/289481/EN-US/
you have to issu something like
你必须发布类似的东西
proxycfg -d -p myProxyServer:80 "<local>"
...
edit:
I've also found that using ServerXMLHTTP instead of XMLHttp, you have a setProxy method...
我还发现使用ServerXMLHTTP而不是XMLHttp,你有一个setProxy方法...
http://msdn.microsoft.com/en-us/library/ms760236(VS.85).aspx
and here is a usage example
这是一个用法示例
http://msdn.microsoft.com/en-us/library/ms763680(VS.85).aspx
...
#4
I looked at this thread to solve my issue - it helped but there are changes to newer systems now.
My situation was making a web MSXML2.ServerXMLHTTP Call from a corporate server going through Proxy Server with digested Active Directory Credentials.
我看了这个线程来解决我的问题 - 它有所帮助,但现在有更新的系统。我的情况是从公司服务器进行Web MSXML2.ServerXMLHTTP调用,通过代理服务器使用已消化的Active Directory凭据。
There were a couple issues here for me, but I eventually managed to get it to work with just the Standard MSXML2.ServerXMLHTTP without having to specify the .3.0 or .6.0 versions.
这里有几个问题,但我最终设法让它只使用标准MSXML2.ServerXMLHTTP,而不必指定.3.0或.6.0版本。
Newer windows servers do not have proxycfg, you need to use netsh as mentioned earlier.
较新的Windows服务器没有proxycfg,您需要使用前面提到的netsh。
There are a few things you need lined up.
In my scenario I was running the Website and Application Pool under the credentials of the AD User Account (This was required for database access) I would suggest that at least the Application Pool would need to run as the AD Account
你需要排列一些东西。在我的场景中,我使用AD用户帐户的凭据运行网站和应用程序池(这是数据库访问所必需的)我建议至少应用程序池需要作为AD帐户运行
This was on a 64 Bit Windows System
这是在64位Windows系统上
- Obviously the AD User will need to have internet access
- You will need to specify the winhttp proxy settings using netsh
- If you have 'Enable 32 bit Applications' Enabled you will also need to set the winhttp proxy for 32 bit. It will look for that setting.
显然,AD用户需要访问互联网
您需要使用netsh指定winhttp代理设置
如果启用了“启用32位应用程序”,则还需要将winhttp代理设置为32位。它会寻找那个设置。
So how?
Check winhttp proxy settings At the Command Line
检查winhttp代理设置在命令行
%WINDIR%\System32\NETSH WINHTTP SHOW PROXY
Check winhttp proxy settings At the Command Line
检查winhttp代理设置在命令行
%WINDIR%\SysWOW64\NETSH WINHTTP SHOW PROXY
If you need to set them From the Command Line [change 8080 to your port]
如果需要从命令行设置它们[将8080更改为您的端口]
%WINDIR%\System32\NETSH WINHTTP SET PROXY PROXYSERVERURL:8080
%WINDIR%\SysWOW64\NETSH WINHTTP SET PROXY PROXYSERVERURL:8080