Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wiki update request #127

Open
dm-CaT opened this issue Aug 3, 2017 · 8 comments
Open

Wiki update request #127

dm-CaT opened this issue Aug 3, 2017 · 8 comments

Comments

@dm-CaT
Copy link

dm-CaT commented Aug 3, 2017

Hello.

At last I found how to configure local environment to run app with Restup server locally without any device. I think it will be useful to put this information into Wiki. I'm not familiar with GitHub Wiki maybe someone can help with it or just copy-paste the following guide?

There are two steps to configure an environment.

  1. https://developer.microsoft.com/en-us/windows/iot/docs/embeddedmode configure Embedded Mode for Windows 10 (follow Changing the mode step-by-step guide).
    This will allow to start UWP application with IoT library referenced locally. But the server will not be accessible from local machine (e.g. http://localhost:8080) because of local loopback prohibiting.
    Make sure you changed solution target platform from ARM to X64.
  2. Enable local loopback for debug sessions https://msdn.microsoft.com/en-us/library/windows/apps/hh780593.aspx
    Run in command-line:
    CheckNetIsolation.exe LoopbackExempt -s
    You'll get a list of IoT applications registered similar to
List Loopback Exempted AppContainers

[1] -----------------------------------------------------------------
    Name: IoTCoreDefaultApp_1w720vyc4ccym
    SID:  <application SID>

Now you have to run debugging session with loopback enabled:
CheckNetIsolation.exe LoopbackExempt -is -n=IoTCoreDefaultApp_1w720vyc4ccym
That's all. Now you can open your web application from local machine: http://localhost:8080. Don't forget to set correct port which is specified in HttpServerConfiguration.ListenOnPort(8080) method.

You can also configure auto startup of loopback enabling via scheduled tasks:
schtasks /create /tn MyTask /f /sc onstart /ru system /tr "checknetisolation LoopbackExempt -is -n=IoTCoreDefaultApp_1w720vyc4ccym"

@tomkuijsten
Copy link
Owner

Kudos for finding this solution 👍 . It would be great if we could add this to our FAQ or a separate page. Any suggestion on where to put it? And could you format the text a bit to be used as Wiki info?

@dm-CaT
Copy link
Author

dm-CaT commented Sep 12, 2017

OK, I'll try.

@dm-CaT dm-CaT mentioned this issue Mar 10, 2018
@dapug
Copy link

dapug commented Aug 16, 2018

This solution didn't solve it for me. I followed it carefully. Is there something else needed in current builds of Windows?

@dm-CaT
Copy link
Author

dm-CaT commented Aug 16, 2018

I didn't try to repeat it for a long time. Maybe something changed.
Which Windows version do you have?
Did you face some errors or something like that on some step of the guide?

@dapug
Copy link

dapug commented Aug 16, 2018

Im on Win10 build 17134.165. No error, I just simply can't make a request (for example, from browser to my UWP app listening on 8800). I get a 400.

Worked ok on an older Win10 machine, so I know RestUp and my little test app is ok (been using it a while, its great).

@dapug
Copy link

dapug commented Aug 22, 2018

Resolved. I had two apps with different port settings I was working with and the failure was simply due to the request going nowhere.

New problem: There is a huge 20 second delay for Restup to respond to any request, even a simple hello-world GET request. I may need to open a new issue.

@agrath
Copy link

agrath commented Nov 1, 2018

//https://stackoverflow.com/a/33263253/647728

For a line of business app use the checknetisolation.exe tool to grant the app a loopback exception.

To enable loopback use this command:

c:>checknetisolation loopbackexempt -a -n=
To disable loopback use this command:

c:>checknetisolation loopbackexempt -d -n=
The package family name for a UWP app can be found in several places: Visual Studio shows it in Package.appxmanifest editor on the packaging tab, PowerShell's get-appxpackage cmdlet displays it, etc. It will look something like "MyPackage_edj12ye0wwgwa"

@agrath
Copy link

agrath commented Nov 1, 2018

I would like to add to this - even with the loopbackexempt as per my above comment, I still could not get the StreamSocketListener to accept incoming connections from my local machine into the UWP app running locally.
I tried with postman and chrome, both the -is and -a methods of adding the loopback exemption (with the correct program)
I also made sure my wifi on my laptop was set to a private network, disabled the firewall.

The note on this page is very subtle:
https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/StreamSocket

Note Network communications using an IP loopback address cannot normally be used for interprocess communication between a UWP app and a different process (a different UWP app or a desktop app) because this is restricted by network isolation. Network communication using an IP loopback address is allowed within the same process for communication purposes in a UWP app

You cannot use the loopback exemption to connect between processes/apps - only within the same app as a loopback exemption.
I have tested the server connecting from a different PC on the local network and can confirm it accepts connections fine now :)
So now testing using teamviewer to my other machine ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants