page_type | urlFragment | languages | products | description | |||
---|---|---|---|---|---|---|---|
sample |
iotcore-service |
|
|
A simple shared host service for Windows 10 IoT Core. |
This sample creates a simple shared host service for Windows 10 IoT Core.
- Download this sample from here.
- Open IotCoreService.sln, select the appropriate platform and build the project. The path containing IotCoreService.dll will be displayed in your Visual Studio Output view. It will look something like this: IotCoreService.vcxproj -> D:\samples-develop\IotCoreService\ARM\Debug\IotCoreService.dll.
- Copy IotCoreService.dll to your device. You can connect and make modifications to your device when it is running by opening Windows Explorer and entering \\C$\Windows\System32.
- To configure your service, copy ConfigureIotCoreService.bat to your device, connect to your device using SSH or Powershell, and run ConfigureIotCoreService.bat. This will update the registry to enable IotCoreService on boot.
- Restart your device.
- Query your service by running
sc query IotCoreService
. Given the configuration we've set up, you should see output like this:
SERVICE_NAME: iotcoreservice
TYPE : 20 WIN32_SHARE_PROCESS
STATE : 2 START_PENDING
(NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x7d0
- At this point, ServiceMain has been called. There is no functionality presently in ServiceMain, but you can consult the MSDN documentation to add functionality as desired!
- To stop your service, run
ConfigureIotCoreService.bat remove
to remove the service configuration and restart your device.