【发布时间】: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