【问题标题】:cant get fiddler to record requests from wcftestclient.exe?无法让 fiddler 记录来自 wcftestclient.exe 的请求?
【发布时间】:2012-07-05 11:47:36
【问题描述】:

我使用 Visual Studio 开发服务器构建了一个非常基本的 wcf 服务,只是为了查看 fiddler 工作:

c#

 public class Service1 : IService1
    {
        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }

        public CompositeType GetDataUsingDataContract(CompositeType composite)
        {
            if (composite == null)
            {
                throw new ArgumentNullException("composite");
            }
            if (composite.BoolValue)
            {
                composite.StringValue += "Suffix";
            }
            return composite;
        }
    }

web.config

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="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>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

当我运行 wcftestclient 时,它显示 getdata() 有效,但未显示在提琴手中?我该如何修改?

谢谢 P

【问题讨论】:

  • 请参阅this other SO question,了解如何设置 WCF 以通过您的 Fiddler 代理,以便 Fiddler 可以捕获您的请求。您还必须在 WCF 测试客户端中定义该代理,以便让 Fiddler 有机会查看请求
  • 它不适用于使用 WSHttpBinding 的设置,而使用 BAsicHttpbinding 则可以使用

标签: wcf fiddler wcftestclient


【解决方案1】:

您的服务地址是什么?如果您使用 localhost 或 127.0.0.1 这些消息将不会被捕获。使用您的机器名称或网络 IP 地址。您可以在项目属性中设置,也可以直接在端点上设置。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-02
    • 1970-01-01
    • 2019-10-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多