如果没有配置浏览器,Netnanny或k9 Web Protection如何设置Web代理?怎么做到呢?
我想打电话给网络服务.我需要使用使用WPAD脚本的代理.此WPAD脚本的URL对于应用程序的不同部署是不同的.
虽然IE具有正确的代理设置,但应用程序作为在本地系统帐户下运行的Windows服务运行,因此应用程序不知道此Windows用户的IE设置.
将以下内容放在app.config中:
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true" >
<proxy autoDetect="True" scriptLocation="http://url.to/wpad.dat"/>
</defaultProxy>
</system.net>
Run Code Online (Sandbox Code Playgroud)
但是这具有用户无法配置的限制.有没有办法从(C# - )代码动态执行上述操作?我也怀疑上面会改变不应该通过代理的webservices的行为(但我还没有验证).
在http://msdn.microsoft.com/en-us/library/system.net.webproxy.aspx中,我找到了有用的文本:"(有关演示使用WPAD功能的示例,请参阅IWebProxyScript类的文档. )"但我没有找到这个例子:(.
我有 Client + Win 服务。
两者都必须使用代理与 Web 服务器一起使用。
没有代理一切正常,
使用系统代理设置(来自 ie 的代理设置)
WebRequest.DefaultWebProxy
Run Code Online (Sandbox Code Playgroud)
客户端工作正常,但服务看不到此代理设置(netsh winhttp set proxy别帮我)。所以 - 代理服务器工作正常
当我尝试使用手动设置时:
var_proxy = new WebProxy(Server + ":" + Port, true)
{Credentials = null};
var request = (HttpWebRequest)WebRequest.Create(target);
request.ContentType = Constants.ContentType; // Default content type
request.UserAgent = _userAgentHeader;
request.Method = "POST";
request.Proxy = _proxy;
Run Code Online (Sandbox Code Playgroud)
正如我在代理日志中看到的 - 它适用于 http 服务器,但不适用于 https!所有请求都直接进行。我该如何解决?
我正在尝试通过.net core 2.0 Web应用程序中的WebProxy发出HTTP请求.我在.net框架中得到的代码工作正常,所以我知道(相信)它不是一个环境问题.我也尝试使用两者来发出请求HttpWebRequest,HttpClient但这两种机制总是导致.net核心中的407(需要代理身份验证)http错误.它好像在.net核心中,我提供的凭据总是被忽略.
这是我一直在使用的代码:
public void Test()
{
var cred = new NetworkCredential("xxxxx", "yyyyyy");
var proxyURI = new Uri("http://xxx.xxx.xxx.xxx:80");
var destinationURI = new Uri("http://www.bbc.co.uk");
WebProxy proxy = new WebProxy(proxyURI, false) { UseDefaultCredentials = false, Credentials = cred };
MakeProxyRequestViaHttpWebRequest(proxy, destinationURI);
MakeProxyRequestViaHttpClient(proxy, destinationURI);
}
private void MakeProxyRequestViaHttpClient(WebProxy proxy, Uri destination)
{
HttpClientHandler handler = new HttpClientHandler()
{
Proxy = proxy,
UseProxy = true,
PreAuthenticate = true,
UseDefaultCredentials = false
};
HttpClient client = new HttpClient(handler);
HttpResponseMessage …Run Code Online (Sandbox Code Playgroud) 我正在尝试解析另一个服务器中的WSDL文件,但在整个文档中都有硬编码的"localhost".
当我拿到它时,显然该程序抱怨"连接被拒绝",因为我的机器中没有运行.
我的问题是:是否可以使用webproxy(如fiddler)将这些localhost请求重定向到我的其他服务器,以便完成WSDL引用?
: - /
谢谢
ps我可以随时修复遥控器"wsdl",但负责人将在这里待到下周,我想今天开始工作.
我正在使用 RestEasy ProxyFactory 连接到 REST 服务。但是我需要通过网络代理进行连接。如何指定代理连接详细信息?
目前我正在使用以下命令创建实例:
MyInterface instance = org.jboss.resteasy.client.ProxyFactory.create(MyInterface.class,url);
instance.doStuff();
Run Code Online (Sandbox Code Playgroud)
但是,它没有连接。
RestEasy 似乎在幕后使用 Apache Commons HTTPClient,它不允许您使用标准 Java 系统属性指定代理。
环境:MAC进程
我研究了使用 MonoTouch、HttpClient 和 Charles Proxy 时的 HTTP 流量监控问题。
虽然我的问题与之类似,但我的应用程序正在使用RestTemplate http://docs.spring.io/autorepo/docs/spring-android/1.0.x/reference/html/rest-template.html。每当请求通过网络浏览器(具体来说是 Safari 和 Chrome)时,我都能够捕获 HTTP 和 HTTPS 流量,而当我通过我的应用程序(基本上使用 RestTemplate)发出休息请求时,Charles 代理不会捕获它们。
从上述问题的答案来看,应该是与RestTempate上的代理设置有关。但我是一名 .NET 开发人员,对 fiddler 非常熟悉 - 但最近转向 Java,对 Charles 还很陌生 - 因此,如果您能让我知道具体细节,或者您对配置 REST 模板以使用我的 macOS 代理的想法,那就太好了。 ..
基本上问题是如何配置我的休息模板(客户端),以便 charles Web 代理能够通过我的应用程序(客户端)捕获请求和响应。
其余模板由扩展 __https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/client/ SimpleClientHttpRequestFactory .html 的自定义请求工厂实例化。
看起来我需要做类似的事情(参考:http://docs.spring.io/spring-integration/reference/html/http.html#http-proxy)
<bean id="requestFactory"
class="org.springframework.http.client.SimpleClientHttpRequestFactory">
<property name="proxy">
<bean id="proxy" class="java.net.Proxy">
<constructor-arg>
<util:constant static-field="java.net.Proxy.Type.HTTP"/>
</constructor-arg>
<constructor-arg>
<bean class="java.net.InetSocketAddress">
<constructor-arg value="123.0.0.1"/>
<constructor-arg value="8080"/>
</bean>
</constructor-arg>
</bean>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud) 查尔斯代理或其他工具中是否有任何选项,我可以保存/缓存所有请求,下次当相同请求出现时,它返回相同的响应而不转发请求。
如果我想使用webProxy绕过像192.168.1.0/24这样的网络有什么办法吗?
WebProxy proxy = new WebProxy();
proxy.ByPassList = ???
Run Code Online (Sandbox Code Playgroud) 我正在尝试从C#.NET获取HTTP调用到本地地址(localhost:3000)以使用我设置的代理(因此我可以通过fiddler).如果我将目标URL指向非本地地址,则使用下面的WebProxy方法,但是我需要将它指向我所拥有的本地Web服务器(在localhost:3000),当我这样做时,请求不会发生通过代理.
我已经包含了"proxyObject.BypassProxyOnLocal = false".这应该让它无效吗?任何建议如何强制请求通过WebProxy进行针对本地地址的http调用?
WebProxy proxyObject = new WebProxy("http://localhost:8888/", false);
proxyObject.Credentials = new NetworkCredential();
proxyObject.BypassProxyOnLocal = false;
WebRequest.DefaultWebProxy = proxyObject;
var request = (HttpWebRequest)WebRequest.Create(targetUri);
// I also included this line as a double check
request.Proxy = proxyObject;
Run Code Online (Sandbox Code Playgroud)
然而,后续调用不会通过代理,例如当我执行时:
var res = (HttpWebResponse)req.GetResponse();
Run Code Online (Sandbox Code Playgroud)
谢谢
webproxy ×10
c# ×5
.net ×3
proxy ×3
fiddler ×2
http ×2
java ×2
.net-core ×1
asp.net-core ×1
http-proxy ×1
https ×1
installation ×1
resteasy ×1
web-services ×1