11

I have a headless app developed in C# for the Raspberry Pi 2 B.

I am able to debug the app fine in visual studio. I have an Ethernet cable connected directly between my workstation and the board. When I navigate in my browser to: minwinpc:8080/AppXManager.htm I can see the program I want in the installed app list. I have tried to remove it, rebuild/redeploy in VS and the app leaves and comes back from the list; thus I know its the current version.

The problem is: I can not get it to "Start" from the web GUI. I select my app, and then get the follow error:

Failed to start package BlinkyHeadlessCS-uwp_q8jk9dv1tcdg!App

How can I set my blink program to start from the Web UI and then, how can I get it to run automatically after I boot?

  • Must be an exception thrown at start of the app. Unfortunately MS is well-known for this, especially on all this new tech they made, they slacked allot on error control. Maybe remote debug, not build debug, may help. I am setting up IoT now and going to do some suff. If you care to share your code I can try and help, I have many years of experience with .NET stuff. Or try to access a stack dump somewhere. – Piotr Kula Sep 2 '15 at 18:49
  • To autostart the app you need to use powershell and set some registry settings. Will try and answer this question once I get an app going. – Piotr Kula Sep 2 '15 at 18:50
  • Thanks for the diagrams... the error I'm now getting after following the steps below of checking the box "Do Not Launch..." is Output type 'Windows Runtime Component' is not supported by one or more of the project's targets – fifamaniac04 Sep 3 '15 at 7:22
  • Make sure arm is selected and not x86 – Piotr Kula Sep 3 '15 at 7:35
  • You can debug using serial port as described here.. but not sure how much sensful data you may get doing that. ms-iot.github.io/content/en-US/win10/Windbg.htm – Piotr Kula Sep 3 '15 at 12:28
10

WOOO HOOO!!!!

OK so I finally got it...

this is what worked for me with only deploying one (1) Headless app.

Step1: Open Powershell as Administrator

Step2: Connect to the board with this command: net start WinRM ... NOTE I had an Ethernet cable directly from my laptop to the raspberry pi 2 board. NOTE if you've been running VS already, it'll tell you that you've already establish connection...

Step3: in powershell, run this next Set-Item WSMan:\localhost\Client\TrustedHosts -Value minwinpc ... I've left the default name for my device. NOTE when prompted, type 'Y'

Step4: Enter-PSSession -ComputerName minwinpc -Credential minwinpc\Administrator ... NOTE You will be prompted for password... assuming default, enter "p@ssw0rd" - yes, case-sensitive

Step5: wait a little while... seriously it takes a moment...

Step6: in powershell, you will now see the device name in the prompt - type the following command: IotStartup remove

Step7: in powershell... type : IotStartup list ... from this we want to get the name of the headless app you want to default to.

Step8: in powershell... type: IotStartup add headless <the-exact-full-name-of-the-headless-app-here>

step9: in powershell... type: setbootoption headless.... this will prompt you to reboot if successful

step10: in powershell... type: shutdown /r /t 0 ... this will cause your device to reboot, immediately

--DONE.... from here just wait for you app to kick off! I had a simple LED program and it started eventually on it's own after the reboot.

  • I was able to use this method as well. Microsoft should fix the underlying issue preventing you from doing it from the Web UI. – Jamie Keeling Sep 23 '15 at 20:19
1

You can attach to your App from Visual Studio. (Debug Only, release doesnt seem to work)

  • Open Visual studio with the source code of your project
  • On the project in Solution Explorer, right click on it.
  • Go to Debug
  • Tick the Do not launch, but debug my code when it starts
  • Save
  • Click run on "Remote Machine"
  • It will deploy the app but wont run it.
  • So run it on the Pi or via the WebGui, and hopefully Visual Studio will break at the error, giving you a much better idea of what is going wrong.

If your app does not hit an exception break point while debugging but you still get an error, its something else that is broken. Maybe your SD card has corrupted files? Try another SD card and a fresh install

Autostart app

You can this via the WebGui Now

enter image description here

Or you can connect to the IoT powershell command line using SSH or Powershell, I think SSH is easier.

  • List the apps installed, you can provide your app name optionally as a filter
  • use the add headed (for apps that use a screen) or headless (for headless apps) command and the appName if the result before was a single item or the full wierd name instead after header :
  • Restart

Commands:

  iotstartup list <optional:appname>
  iotstartup add headed:headless 64e9d643-619e-40e0-91b0-8e54f3e32aa8_953wxc6k7hb7r!App
  # AppID changed to your 64e9d643-619e-40e0-91b0-8e54f3e32aa8_953wxc6k7hb7r!App
  shutdown /r /t 0

and to reset the default app

  iotstartup add headed DefaultApp

More debugging options

You can also attach to any remote process without opening any project, and just clicking on the Attach play button. But this won't work well if it crashed at launch, but may work if an app crashes at a specific location each time.

enter image description here

You can view the crash dump from the WebGUI under Debugging but those dump files are Kernel specific and can be very tedious to debug. This doesn't include any error messages, or easy to understand stack dump. More information here, although I could not open any .dmp file in Visual 2015, maybe because its the community edition. But even my Pro 2013 wont open it.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.