WCF 调用未显示在 Fiddler2 中
我有一个带有 basicHttp 绑定的简单 WCF 服务。该服务在本地(Win7 笔记本电脑)的 IIS7 中托管。我可以浏览该服务: http://localhost/musicstore/musicstore.svc (端口 80)
我开发了一个简单的 Windows 窗体客户端应用程序来调用该服务。它工作正常,但我真的很想通过 Fiddler2 看到消息调用/响应。当我浏览网页时,Fiddler2 会很高兴地报告流量,所以我不明白为什么它没有接听这个 WCF 调用?
是否有另一种方法可以查看 WCF 调用的数据。也许有一个微软工具?
客户端配置为:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<client>
<endpoint address="http://localhost/musicstore/musicstore.svc"
binding="basicHttpBinding" bindingConfiguration="" contract="MusicStore.IMusicStore"
name="BasicHttp" />
</client>
</system.serviceModel>
</configuration>
服务配置为:
<services>
<service behaviorConfiguration="MusicStoreBehavior" name="MusicStore">
<endpoint address="" binding="basicHttpBinding" contract="IMusicStore">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
I have a simple WCF Service with basicHttp binding. The service is hosted locally (Win7 laptop) in IIS7. I'm able to browse the service at: http://localhost/musicstore/musicstore.svc
(port 80)
I've developed a simple windows form client app to call the service. It works fine but I'd really like to see the message call / response through Fiddler2. Fiddler2 will happily report traffic as I browse the web so I can't understand why it's not picking up this WCF call?
Is there another way to view the data on WCF calls. Maybe there's a Microsoft Tool?
The client config is:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<client>
<endpoint address="http://localhost/musicstore/musicstore.svc"
binding="basicHttpBinding" bindingConfiguration="" contract="MusicStore.IMusicStore"
name="BasicHttp" />
</client>
</system.serviceModel>
</configuration>
The service config is:
<services>
<service behaviorConfiguration="MusicStoreBehavior" name="MusicStore">
<endpoint address="" binding="basicHttpBinding" contract="IMusicStore">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
查看 WCF 正在执行的操作的最简单方法是打开 WCF 自己的日志记录。您可以通过编辑 web.config 并添加
MSDN 来完成此操作,其中包含有关您的内容的更多详细信息可以配置。您可以在服务跟踪查看器中查看日志。
The easiest way to see what WCF is doing is to turn WCF's own logging on. You can do this by editing your web.config and adding
MSDN has more detailed information on what you can configure. You can view the logs in the Service Trace Viewer.
这个问题有很多重复,其中很多都有正确答案。您应该使用 http://localhost.fiddler/ 作为目标,.NET 将正确代理该请求。然后,在传递请求之前,Fiddler 会将“localhost.fiddler”更改为“localhost”。
There are many duplicates of this question, many of which have correct answers. You should use http://localhost.fiddler/ as the target and .NET will properly proxy the request. Fiddler will then change "localhost.fiddler" to "localhost" before passing on the request.
您可以修改客户端的配置文件:
或者您可以使用:
来自:Fiddler 站点
You can modify your client's configfile:
Or you could use:
From: Fiddler site
我遇到了同样的问题,并通过以下方式修复了它:
使用 dutch nico 的代理配置(见下文) )
确保您的客户端应用程序使用您的“外部”IP。因此,192.168.1.X 而不是 localhost。
您可能需要更改 WCF 配置以允许 ASP.NET 4.0 的多个绑定
I had the same problem and fixed it this way:
Use the proxy configuration of dutch nico (see below)
Make sure your client application uses your 'external' ip. So 192.168.1.X instead of localhost.
You might have to change your WCF config to allow multiple bindings for asp.net 4.0