gpt4 book ai didi

asp.net-mvc - Fiddler 未从 LINQPad 上的 webClient 捕获本地流量

转载 作者:行者123 更新时间:2023-12-04 03:05:50 24 4
gpt4 key购买 nike

团队,

我有以下来自 LINQPad 的简单 WebClient 调用。我如何尝试 Fiddler 只是拒绝捕获。我只是没办法了。我试过 localhost、localhost.(带点)、localhost.fiddler 和我的机器名,而不是 127.0.0.1。 Fiddler 根本没有兴趣捕获它。任何人都有任何想法。

void Main()
{
CookieWebClient client = new CookieWebClient()
{
Proxy = new WebProxy("127.0.0.1", 8888) // Fiddler
};
Console.WriteLine(client.DownloadString(url)); // Cookie is created here
Console.WriteLine(client.DownloadString(url)); // In this request, the cookie gets sent back to the web API
Console.WriteLine("Done");
}

// Define other methods and classes here

public class CookieWebClient : WebClient
{
private CookieContainer jar = new CookieContainer();
protected override WebRequest GetWebRequest(Uri address)
{
WebRequest request = base.GetWebRequest(address);
HttpWebRequest webRequest = request as HttpWebRequest;
if (webRequest != null)
webRequest.CookieContainer = jar;
return request;
}
}
string url = "http://localhost:21531/api/employees/12345";

最佳答案

您还没有解释尝试时实际发生了什么

.NET Framework 绕过对 localhost 的任何 HTTP/HTTPS 请求的代理,因此您必须使用 localhost.fiddler 作为主机在您的 string url 中。当您这样做时,有两种可能性:

  1. 请求成功,说明Fiddler抓到了流量
  2. 请求失败,这意味着您的客户端未正确配置为代理其请求。

关于asp.net-mvc - Fiddler 未从 LINQPad 上的 webClient 捕获本地流量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26182939/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com