测试 Windows Phone 7 中的连接问题(使用模拟器)

发布于 2024-11-04 20:51:11 字数 125 浏览 0 评论 0原文

Windows Phone 7 模拟器中有没有办法关闭网络连接(无需拔下电缆并关闭笔记本电脑上的 Wi-Fi)?我想在没有物理设备或在模拟器或 Windows Phone 7 SDK/工具之外执行任何物理操作的情况下测试网络连接的下降。

Is there a way in the Windows Phone 7 emulator to turn off the network connection (without yanking the cable and turning wi-fi off on my laptop)? I want to test the dropping of network connectivity without having a physical device or doing anything physical outside the emulator or the Windows Phone 7 SDK/Tools.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

夜夜流光相皎洁 2024-11-11 20:51:11

As an alternative to physically disabling the network connection I also, sometimes, find it useful to redirect the network connections through Fiddler2. It's then possible to use breakpoints to intercept some connections. You can then use this add a delay before the server can respond. Or you can force a timeout.
I find this a useful approach when you want to test some connections failing but not others.

爱格式化 2024-11-11 20:51:11

不,不是真的。我发现检查网络连接并将结果分配给布尔值很有用,以便我可以修改结果以测试没有网络连接的场景。

No, not really. I find it useful to check network connectivity and assign the result to a boolean value so that I can then modify the result to test scenarios where there's no network connection.

皇甫轩 2024-11-11 20:51:11

为应用程序C:\Program Files\Microsoft XDE\1.0\XDE.exe 创建防火墙规则,然后启用/禁用此规则。

Сreate a firewall rule for the application C:\Program Files\Microsoft XDE\1.0\XDE.exe and then enable/disable this rule.

━╋う一瞬間旳綻放 2024-11-11 20:51:11

您可以使用 Fiddler 中的自定义规则来执行此操作。

规则->自定义规则...

找到添加“模拟和调制解调器速度”菜单选项的代码,然后添加新选项

//Add a menu option under Rules -> Performance
public static RulesOption("Simulate Flight Mode", "Per&formance")
var bFlightMode: boolean = false;   

现在,在 OnBeforeRequest 函数的顶部,添加以下代码

// Cause Fiddler to respond to all requests with a 502 (Bad Gateway) - the same error you get when you remove all networks
if (bFlightMode){
    oSession.oRequest.pipeClient.End();
    oSession.utilCreateResponseAndBypassServer();
    oSession.oResponse.headers.HTTPResponseCode = 502;
    oSession.oResponse.headers.HTTPResponseStatus = "Fiddler Simulating Flight Mode";
    oSession.state = SessionStates.Aborted;
    return;
}   

现在,在“性能”菜单下,您可以可以选择“飞行模式” - 或任何您想要的名称。

(基于 @EricLaw Google 网上论坛帖子

You can do this using a custom rule in Fiddler.

Rules -> Customize Rules...

Find the code which adds the "Simulate &Modem Speeds" menu option, and add your new option

//Add a menu option under Rules -> Performance
public static RulesOption("Simulate Flight Mode", "Per&formance")
var bFlightMode: boolean = false;   

Now, at the top of the OnBeforeRequest function, add the following code

// Cause Fiddler to respond to all requests with a 502 (Bad Gateway) - the same error you get when you remove all networks
if (bFlightMode){
    oSession.oRequest.pipeClient.End();
    oSession.utilCreateResponseAndBypassServer();
    oSession.oResponse.headers.HTTPResponseCode = 502;
    oSession.oResponse.headers.HTTPResponseStatus = "Fiddler Simulating Flight Mode";
    oSession.state = SessionStates.Aborted;
    return;
}   

Now, under the 'Performance' menu, you can select 'Flight Mode' - or whatever you want to call it.

(Based on an @EricLaw Google Groups post)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文