UWP Raspberry Pi Web服务器问题 [英] UWP Raspberry Pi Webserver issue

查看:97
本文介绍了UWP Raspberry Pi Web服务器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在跟踪Web服务器的示例应用程序,通过带有端口的TCP处理传入的请求.

I'm following the sample application of a Webserver, handling incoming requests through TCP with a Port.

带有代码的示例应用程序:

Sample application with code: https://incredibits.io/project/windows-10-iot-internet-of-things-tips/windows-10-iot-raspberry-pi-web-server

在Windows 10机器上调试UWP应用程序时,尝试访问本地IP(192.168.x.x<-当然,我已经输入了我的实际本地IP),我得到了我想要的.该应用程序收到传入请求,并在我的另一台计算机上将一些数据返回给我(客户端).

When debugging the UWP application on my Windows 10 machine, and try to access the the local IP (192.168.x.x <- Ofcourse I've entered my actual local IP) I get what I'm supposed to. The application get's an incoming request and returns some data back to me (The client) on another computer of mine.

我面临的问题是,当我将其部署到运行Windows 10 IoT核心版(来自Insider的最新版本)的Raspberry Pi 3时,我根本无法从客户端计算机访问该应用程序.是Pi的防火墙引起的事情还是其他阻止此事情的发生?

The issues I'm facing is when I deploy this to my Raspberry Pi 3 running Windows 10 IoT Core (The newest from Insider), I can't access the application from my client computer at all. Is this a thing with the Pi's firewall or something else preventing this?

我可以在端口8080上访问IoT Core的Web界面,但无法访问在端口80上运行的应用程序.(我也尝试将端口切换到另一个端口,该端口在Windows 10上本地运行,但在Pi上不行)

I CAN access the IoT Core's Web interface on port 8080, but I cannot access my application running on port 80. (I've tried switching the port to another one aswell, works locally on my Windows 10 but not on the Pi)

有人知道解决方案,还是遇到过类似的问题?

Does anyone know a solution, or have faced a similar issue?

注意: 我还尝试了类似( https://ms-iot.github的示例. io/content/zh-cn/win10/samples/BlinkyWebServer.htm ),它同样可以在我的Windows 10 PC上运行,并且如果我的其他PC在同一网络上,但不能在我的Pi上也可以访问)

Note: I've also tried examples like (https://ms-iot.github.io/content/en-US/win10/samples/BlinkyWebServer.htm) which again, works on my Windows 10 pc, and can be accessed by my other PC if their on the same network, but not on my Pi)

推荐答案

我找到了解决问题的方法.

I found the solution to my problem.

我正在使用的端口未在Raspberry Pi的防火墙中打开.我找不到如何向防火墙添加规则的方法,但是在Freenode C#聊天论坛上获得了一些帮助之后,我发现了以下代码片段:

The port I was using, wasn't opened up in the Raspberry Pi's Firewall. I couldn't find how to add a rule to the Firewall but after some help on Freenode C# Chat forum, I found the following snippet:

首先,我通过PowerShell登录到Pi

First I log into the Pi through PowerShell

Enter-PsSession -ComputerName MyRaspberryPi-Credential MyRaspberryPi\Administrator

然后,我手动添加我正在使用的端口的防火墙开口.在这种情况下,端口为8080.

Then I manually add the Firewall opening of the port I'm using. In this case port 8080.

netsh advfirewall firewall add rule name="Raspberry Pi Webserver" dir=in action=allow protocol=TCP localport=8080

此后,一切都按预期进行.我可以访问Raspberry Pi上的端口!一切都好!

After that, everything worked as expected. I could access the port on my Raspberry Pi! All good!

感谢评论中的@ canton7和@ taylor-kidd,并提出了最终对我有帮助的建议!

Thanks to @canton7 and @taylor-kidd in the comments, for coming with suggestions that in the end helped me!

编辑4月12日: 似乎防火墙未打开的问题实际上已经是Microsoft已知的问题.他们在"Insider Preview"版本14295(我正在使用的版本)的发行说明中写道: http://ms-iot.github.io/content/zh-CN/win10/ReleaseNotesInsiderPreview.htm

EDIT 12th of April: It seems like this issue with the Firewall not being opened, was actually a known issue by Microsoft already. They write that in their Relase notes for the Insider Preview version 14295 (Which I am using) here http://ms-iot.github.io/content/en-US/win10/ReleaseNotesInsiderPreview.htm

这篇关于UWP Raspberry Pi Web服务器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆