Windows-iotcore-samples
Windows-iotcore-samples copied to clipboard
ProcessLauncher UnauthorizedAccessException
We've leveraged the capability of ProcessLauncher. Seems to work fine on some devices. On some others, we get an UnauthorizedAccessException. Details below:
System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at MarqMetrix.InstrumentManagement.FileSystem.NetworkLocations.IoT.IoTNetworkLocationManager.AddNetworkLocation(String share, String username, String password) at MarqMetrix.InstrumentManagement.InstrumentManager.AddNetworkLocationAsync(NetworkLocation networkLocation) at MarqMetrix.InstrumentManagement.WebApi.ODataControllers.NetworkLocationsController.Post(Delta`1 newNetworkLocation) at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync() at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext) at MarqMetrix.InstrumentManagement.InstrumentManagerApplicationBuilderExtensions.<>c__DisplayClass0_0.<<UseMarqMetrixWebApiNotifications>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context
So far we've tested on 3 different devices. Each running an 1809 version of IoT Core. 2 boxes, the process launcher works. 1 box it doesn't. Interestingly, the box that it doesn't work on is the most recently setup device (flashed with IoT Core).
In looking at the folder permissions in the location the app is installed, it appears there is a difference between the boxes this works on and the one it doesn't.
We are having the same issue when attempting to launch executables from the AppX package using the ProcessLauncherSample on devices running 1809 of Windows IoT Core. We've determined that the sample runs correctly on the device when deploying from Visual Studio both with .exe paths added to the registry in the AllowedExecutableFilesList and from the AppX, however we get the System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) error when sideloading the AppX via Device Portal or deploying OTA via the DM API and device twin. It appears that access to C:\Data\Programs\WindowsApps is not allowed to ProcessLauncher even when the path is added to AllowedExecutableFilesList which prevents programs from being run from AppX.