2015-11-08 73 views
0

我正在使用Fiddler.Core來攔截HTTP請求。提琴手獲取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端口?

謝謝

+0

您是否嘗試過運行FiddlerCore包附帶的'Demo \ Program.cs'示例來了解它的工作原理?您的'Main()'函數中的無限循環將掛住CPU的單核。 – EricLaw

回答

0

我懷疑端口80已被IIS使用。您需要關閉IIS或更改端口提琴手的使用。