新ControlChannelTrigger(WinRT)中的访问被拒绝(HRESULT 0x80070005)

时间:2012-07-20 13:45:19

标签: c# background windows-runtime

我完全绝望了......

这是我的代码:

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

总是抛出UnauthorizedAccessException(HRESULT 0x80070005)。

这是我使用的清单

    <?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>

此处或网上未找到任何答案。不知道发生了什么......

2 个答案:

答案 0 :(得分:1)

哈哈,我把它整理出来了。在周末之前做这件事太明显了。 我必须在“系统设置”中将我的应用程序标记为“锁定屏幕”应用程序。 谢谢大家。

答案 1 :(得分:1)

最初我无法弄清楚如何“在系统设置中将我的应用程序标记为锁屏应用程序”,但在此处找到并希望分享 enter image description here