Fiddler获取HTTP响应

时间:2015-11-08 04:11:28

标签: c# .net http fiddler fiddlercore

我正在使用Fiddler.Core拦截HTTP请求。

以下是我的代码:

        static void Main(string[] args)
        {         
            //Timer t = new Timer(TimerCallback, null, 0, 60000);
            Console.CancelKeyPress += new ConsoleCancelEventHandler(Console_CancelKeyPress);
            FiddlerApplication.BeforeRequest += FiddlerApplication_BeforeRequest;
            FiddlerApplication.BeforeResponse += FiddlerApplication_BeforeResponse;
            FiddlerApplication.AfterSessionComplete += FiddlerApplication_AfterSessionComplete;
            FiddlerApplication.Startup(80, true, true, true);
               while (!_s_stop)
            {

            }
            Console.ReadLine();            
        }

        static void FiddlerApplication_BeforeResponse(Session oSession)
        {
            Console.WriteLine(oSession.url);
        }

        static void FiddlerApplication_BeforeRequest(Session oSession)
        {
            Console.WriteLine(oSession.url);
        }

        static void FiddlerApplication_AfterSessionComplete(Session sess)
        {

            Console.WriteLine(sess.url);
        }

为什么在响应之前和会话之后没有调用? 我使用端口80是真的吗?

由于

1 个答案:

答案 0 :(得分:0)

我怀疑IIS已经在使用端口80。您需要关闭IIS或更改端口fiddler使用。