本文介绍了WP8.1 SilverLight Microsoft.Devices.PhotoCamera 访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在编写 Windows Phone 应用程序时遇到了令人沮丧的时间.

I am having a frustrating time with writing a Windows Phone App.

我有一个 WP8.1 Silverlight 项目.然后我只是尝试初始化相机.我收到 Accessdenied 错误.Package.appxmanifest 文件选择了网络摄像头.我一直无法在论坛上找到关于这个问题的类似帖子.有什么想法吗?

I have a WP8.1 Silverlight project. I am then simply trying to initialize the camera. I get an Accessdenied error. Package.appxmanifest file has webcam selected. I have been unable to find similar posts on forums about this issue in particular. Any ideas?

注意:我有很棒的图片,但是,我需要至少 10 个声望"才能发布图片:(

Note: I have great pictures but, I need "at least 10 reputation" to post images :(

Dim WithEvents cam As PhotoCamera

Public Sub New()
    InitializeComponent()
    If PhotoCamera.IsCameraTypeSupported(CameraType.Primary) = True Then
        cam = New PhotoCamera(CameraType.Primary)
    End If

End Sub

错误如下:Microsoft.Devices.Camera.ni.dll 中出现System.UnauthorizedAccessException"类型的异常,但未在用户代码中处理

Here is the error:An exception of type 'System.UnauthorizedAccessException' occurred in Microsoft.Devices.Camera.ni.dll but was not handled in user code

附加信息:访问被拒绝.(来自 HRESULT 的异常:0x80070005 (E_ACCESSDENIED))

Additional information: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

我正在调试设备(lumia 820 和 W8.1),并使用 VS 2013 for Windows with Update 4.

I am debugging to the device (lumia 820 with W8.1) and am using VS 2013 for Windows with Update 4.

推荐答案

原来还是需要设置 WMAppManifest.不幸的是,找到或操作它的唯一方法是转到目录(在visual studio 之外),然后深入到我的项目"目录.在那里我找到了 WMAppManifest 并且能够直接编辑它.添加了 ID_CAP_ISV_CAMERA,然后能够按预期运行/调试.

It turns out that the WMAppManifest still needs to be set. Unfortunately, the only way to find this or to manipulate it was to go to the directory (outside of visual studio) and then drill into the 'My Project' directory. There I found the WMAppManifest and was able to edit it directly. Added, ID_CAP_ISV_CAMERA and then was able to run/debug as expected.

这篇关于WP8.1 SilverLight Microsoft.Devices.PhotoCamera 访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 01:15