Access Denied (HRESULT 0x80070005) in new ControlChannelTrigger (WinRT)

这一生的挚爱 提交于 2019-12-11 09:38:48

问题


I an in complete despair...

Here's my code:

ControlChannelTrigger theChannel = new ControlChannelTrigger("channelId", 15, ControlChannelTriggerResourceType.RequestHardwareSlot); 

which always throws an UnauthorizedAccessException (HRESULT 0x80070005).

Here's a manifest I use

    <?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
  <Identity Name="cf45d5c8-2936-4d1f-9075-51a87ceb60ba" Publisher="CN=snuk182" Version="1.0.0.0" />
  <Properties>
    <DisplayName>Applic</DisplayName>
    <PublisherDisplayName>snuk182</PublisherDisplayName>
    <Logo>Assets\StoreLogo.png</Logo>
  </Properties>
  <Prerequisites>
    <OSMinVersion>6.2.0</OSMinVersion>
    <OSMaxVersionTested>6.2.0</OSMaxVersionTested>
  </Prerequisites>
  <Resources>
    <Resource Language="x-generate" />
  </Resources>
  <Applications>
    <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Applic.App">
      <VisualElements DisplayName="Applic" Logo="Assets\Logo.png" SmallLogo="Assets\SmallLogo.png" Description="Applic" ForegroundText="light" BackgroundColor="#464646" ToastCapable="true">
        <LockScreen Notification="badgeAndTileText" BadgeLogo="ImageResources\badge.png" />
        <DefaultTile ShowName="allLogos" WideLogo="ImageResources\widelogo.png" />
        <SplashScreen Image="Assets\SplashScreen.png" />
      </VisualElements>
      <Extensions>
        <Extension Category="windows.backgroundTasks" Executable="$targetnametoken$.exe" EntryPoint="Applic.BackgroundTask">
          <BackgroundTasks>
            <Task Type="controlChannel" />
          </BackgroundTasks>
        </Extension>
      </Extensions>
    </Application>
  </Applications>
  <Capabilities>
    <Capability Name="removableStorage" />
    <Capability Name="internetClient" />
  </Capabilities>
</Package>

Have not found any answer either here or in web. Have no idea what's going on...


回答1:


Haha, I've sorted it out. It was too obvious to do it before the weekend. I had to mark my application as Lock Screen app in System Settings. Thanks everybody.




回答2:


Originally i couldnt figure out how to "mark my application as Lock Screen app in System Settings" but found it here and wanted to share



来源:https://stackoverflow.com/questions/11580643/access-denied-hresult-0x80070005-in-new-controlchanneltrigger-winrt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!