简体   繁体   English

UWP Raspberry Pi Webserver问题

[英]UWP Raspberry Pi Webserver issue

I'm following the sample application of a Webserver, handling incoming requests through TCP with a Port. 我正在关注Web服务器的示例应用程序,通过TCP使用端口处理传入请求。

Sample application with code: https://incredibits.io/project/windows-10-iot-internet-of-things-tips/windows-10-iot-raspberry-pi-web-server 代码示例应用程序: https//incredibits.io/project/windows-10-iot-internet-of-things-tips/windows-10-iot-raspberry-pi-web-server

When debugging the UWP application on my Windows 10 machine, and try to access the the local IP (192.168.xx <- Ofcourse I've entered my actual local IP) I get what I'm supposed to. 在我的Windows 10机器上调试UWP应用程序时,尝试访问本地IP(192.168.xx < - Ofcourse我输入了我的实际本地IP),我得到了我应该得到的。 The application get's an incoming request and returns some data back to me (The client) on another computer of mine. 应用程序得到一个传入的请求,并将一些数据返回给我(我的另一台计算机上的客户端)。

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. 我面临的问题是当我将其部署到运行Windows 10 IoT核心的Raspberry Pi 3(来自Insider的最新版本)时,我无法从客户端计算机访问该应用程序。 Is this a thing with the Pi's firewall or something else preventing this? 这是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) 我可以通过端口8080访问IoT Core的Web界面,但是我无法访问在端口80上运行的应用程序。(我已经尝试将端口切换到另一个端口,在我的Windows 10本地工作但不在Pi上工作)

Does anyone know a solution, or have faced a similar issue? 有没有人知道解决方案,或者遇到类似的问题?

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) 注意:我也尝试了一些例子( https://ms-iot.github.io/content/en-US/win10/samples/BlinkyWebServer.htm ),这些例子再次适用于我的Windows 10 pc,并且可以访问通过我的其他PC如果他们在同一个网络上,但不在我的Pi上

I found the solution to my problem. 我找到了解决问题的方法。

The port I was using, wasn't opened up in the Raspberry Pi's Firewall. 我正在使用的端口没有在Raspberry Pi的防火墙中打开。 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: 我找不到如何向防火墙添加规则,但在Freenode C#Chat论坛上提供了一些帮助后,我找到了以下代码段:

First I log into the Pi through PowerShell 首先我通过PowerShell登录Pi

Enter-PsSession -ComputerName MyRaspberryPi-Credential MyRaspberryPi\Administrator

Then I manually add the Firewall opening of the port I'm using. 然后我手动添加我正在使用的端口的防火墙开放。 In this case port 8080. 在这种情况下,端口8080。

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

After that, everything worked as expected. 在那之后,一切都按预期工作。 I could access the port on my Raspberry Pi! 我可以访问我的Raspberry Pi上的端口! All good! 都好!

Thanks to @canton7 and @taylor-kidd in the comments, for coming with suggestions that in the end helped me! 感谢@ canton7和@ taylor-kidd在评论中提出的建议,最终帮助了我!

EDIT 12th of April : It seems like this issue with the Firewall not being opened, was actually a known issue by Microsoft already. 4月12日编辑 :好像防火墙没有打开这个问题,实际上是微软已经知道的问题。 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 他们在他们的Relase Notes for Insider Preview版本14295(我正在使用)中写到这里http://ms-iot.github.io/content/en-US/win10/ReleaseNotesInsiderPreview.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM