如何配置客户端以捕获Fiddler中的本地WCF请求?

时间:2017-03-16 08:23:20

标签: c# wcf fiddler

我有使用WCF的简单客户端应用程序(控制台应用程序)和服务器应用程序(WCF库项目)。我想看看Fiddler中WCF消息的样子。

我将以下代码添加到客户端的app.config:

<configuration>    
  <system.net>
    <defaultProxy>
      <proxy bypassonlocal="False" usesystemdefault="True" proxyaddress="http://127.0.0.1:8888" />      
    </defaultProxy>
  </system.net>

我的小提琴手显示来自浏览器的所有连接,除了一个有#34; vshub&#34;在url中,但显示的WCF客户端/服务器应用程序之间没有任何关联。如何配置?

UPDATE1:

我的WCF服务库(服务器应用程序)按以下方式配置:

<system.serviceModel>
    <services>
      <service name="WcfServer.Service1">
        <host>
          <baseAddresses>
            <add baseAddress = "http://localhost:8733/Design_Time_Addresses/WcfServer/Service1/" />
          </baseAddresses>
        </host>
        <!-- Service Endpoints -->
        <!-- Unless fully qualified, address is relative to base address supplied above -->
        <endpoint address="" binding="basicHttpBinding" contract="WcfServer.IService1">
          <!-- 
              Upon deployment, the following identity element should be removed or replaced to reflect the 
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
              automatically.
          -->
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <!-- Metadata Endpoints -->
        <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
        <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, 
          set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
          <!-- To receive exception details in faults for debugging purposes, 
          set the value below to true.  Set to false before deployment 
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

2 个答案:

答案 0 :(得分:0)

Fiddler没有抓住本地请求。 Fiddler只捕获实际通过线路的请求。 Windows快捷方式是本地请求。

an old post有一些替代方案,但我不知道该列表的实际情况。

答案 1 :(得分:0)

您在客户端配置中无需执行任何操作,您可以删除代理设置。如果您不使用“localhost”并将其替换为“MyMachineName”,Fiddler将会工作