本文介绍了使用Fiddler调试Windows Phone 7模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用Windows Phone 7的更新测试版工具,遇到一个有趣的问题。看起来,随着Fiddler的运行,任何Http请求都会通过仿真器运行,开始返回null结果并创建一个未找到的Web异常。这很容易用WebClient.DownloadStringAsync()重现。如果我记得正确,旧版本的模拟器与Fiddler一起工作。有没有人有运气让两个人一起工作?如果不可能,我可以向任何其他可以帮助从WP7模拟器调试Web请求的工具开放。

I recently started using the updated beta tools for Windows Phone 7 and ran into an interesting problem. It seems that with Fiddler running, any Http requests run through the emulator start returning a null result and create a "not found" web exception. This is easy to reproduce with WebClient.DownloadStringAsync(). The old versions of the emulator did work with Fiddler if I remember correctly. Has anyone had luck getting the two to work together? If it's not possible I'd be open to any other tool that could help debug web requests from the WP7 emulator.

推荐答案

看起来有一个。

这里有一些来自fiddler网站的指示,但是博客文章似乎更清楚一些(对于古怪的格式,抱歉,块报价不合作):

Here is a little bit of the instructions from the fiddler website, but the blog post seems a little clearer (sorry for wacky format, the block quote is not cooperating):

启动REGEDIT创建一个名为
的新DWORD
内的ReverseProxyForPort HKCU\SOFTWARE\Microsoft\Fiddler

Start REGEDIT Create a new DWORD named ReverseProxyForPort inside HKCU\SOFTWARE\Microsoft\Fiddler

将DWORD设置为您要
的本地端口,将入站流量重新路由到
(通常为标准HTTP
的端口80服务器)重新启动Fiddler将
浏览器导航到

Set the DWORD to the local port you'd like to re-route inbound traffic to (generally port 80 for a standard HTTP server) Restart Fiddler Navigate your browser to http://127.0.0.1:8888

选项#2:编写一个FiddlerScript规则
或者,您可以编写一个执行相同操作的规则

Option #2: Write a FiddlerScript rule Alternatively, you can write a rule that does the same thing.

假设您在名为WEBSERVER的机器的端口
80上运行了一个网站。
您使用
Internet Explorer Mobile Edition连接到网站
Windows SmartPhone设备,
您无法配置Web代理。
您要捕获来自
手机和服务器响应的流量。

Say you're running a website on port 80 of a machine named WEBSERVER. You're connecting to the website using Internet Explorer Mobile Edition on a Windows SmartPhone device for which you cannot configure the web proxy. You want to capture the traffic from the phone and the server's response.

在WEBSERVER
机器上启动Fiddler,运行默认端口
为8888.单击工具| Fiddler
选项,并确保允许远程
客户端连接复选框是
检查。如果需要重启。选择
规则|自定义规则在
OnBeforeRequest处理程序中,添加一个新的
一行代码:if
(oSession.host.toLowerCase()==
webserver:8888)oSession.host =
webserver:80;在SmartPhone上,
导航到
来自SmartPhone的请求将
出现在Fiddler。请求是
从端口8888转发到端口80
,其中Web服务器正在运行。
的回复通过
Fiddler发送回SmartPhone,其中
不知道最初的
来自80端口。

Start Fiddler on the WEBSERVER machine, running on the default port of 8888. Click Tools | Fiddler Options, and ensure the "Allow remote clients to connect" checkbox is checked. Restart if needed. Choose Rules | Customize Rules. Inside the OnBeforeRequest handler, add a new line of code: if (oSession.host.toLowerCase() == "webserver:8888") oSession.host = "webserver:80"; On the SmartPhone, navigate to http://webserver:8888 Requests from the SmartPhone will appear in Fiddler. The requests are forwarded from port 8888 to port 80 where the webserver is running. The responses are sent back through Fiddler to the SmartPhone, which has no idea that the content originally came from port 80.

这篇关于使用Fiddler调试Windows Phone 7模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 15:55