如何使用 Microsoft.XMLHTTP 指定代理配置? [英] how can I specify a proxy configuration using Microsoft.XMLHTTP?

查看:43
本文介绍了如何使用 Microsoft.XMLHTTP 指定代理配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用来自经典 asp 页面的 Microsoft.XMLHTTP 将信息发布到另一个站点...

I'm using Microsoft.XMLHTTP from a classic asp page to post info to another site...

我希望能够检查 fiddler 发生了什么,为此我必须找到一种方法来配置 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...

有可能吗?Microsoft.XMLHTTP 从哪里获取其配置?

is it possible? where does Microsoft.XMLHTTP gets its configuration from?

非常感谢

推荐答案

我觉得这里有些事情需要澄清.

I think some things here need clearing up.

ProgIDMicrosoft.XMLHTTP"指向与MSXML2.XMLHTTP"相同的类.此类使用 Internet Explorer 使用的 WinINET HTTP 协议栈,因此将使用在 PC 上的 Internet 设置中找到的任何代理配置.

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.

因此对于Microsoft.XMLHTTP",proxycfg 命令没有用.

Hence for "Microsoft.XMLHTTP" the proxycfg command is not useful.

XMLHTTP 的替代方案是MSXML2.ServerXMLHTTP".此类使用 WinHTTP HTTP 协议栈,该协议栈旨在轻量级和服务器友好.在 WinINET 不是的同一进程中的多个线程中使用多个实例是安全的.为此,服务器端 ASP 代码中应使用 ServerXMLHTTP.

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 不使用 WinINET 使用的 Internet 设置,因此要配置 ServerXMLHTTP 将使用的代理,您需要使用 proxycfg 命令.一个非常有用的命令是:-

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

将当前的 WinINET 代理设置复制到 WinHTTP 使用的设置,如果您使用类似 fiddler 之类的工具,这对于在启动 fiddler 后开始监控通过 WinHTTP 的流量很有用.(请注意,您使用 proxycfg -d 跟进以删除代理设置).

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 也有一个 setProxy 方法,它允许动态配置实际的代理设置为代码.

ServerXMLHTTP also has a setProxy method which allows the actual proxy settings to be configured dynamically be code.

这篇关于如何使用 Microsoft.XMLHTTP 指定代理配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆