Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UWP Raspberry Pi Webserver issue

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

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.

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?

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?

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)

like image 715
Kevin Jensen Petersen Avatar asked Apr 08 '16 14:04

Kevin Jensen Petersen


1 Answers

I found the solution to my problem.

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:

First I log into the Pi through PowerShell

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.

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! All good!

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

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

like image 139
Kevin Jensen Petersen Avatar answered Oct 22 '22 10:10

Kevin Jensen Petersen