C# CaptureSource.Start()在Windows Phone Silverlight 8.1中引发System.UnauthorizedAccessException
我在Windows Phone Silverlight 8.1应用程序中使用摄像头时遇到问题。我只想初始化相机并查看其预览(目前我不需要任何照片或视频捕获)。我已经找到并且 代码在C# CaptureSource.Start()在Windows Phone Silverlight 8.1中引发System.UnauthorizedAccessException,c#,silverlight,windows-phone-8.1,C#,Silverlight,Windows Phone 8.1,我在Windows Phone Silverlight 8.1应用程序中使用摄像头时遇到问题。我只想初始化相机并查看其预览(目前我不需要任何照片或视频捕获)。我已经找到并且 代码在captureSource.Start()处停止抛出System.UnauthorizedAccessException:试图执行未经授权的操作。 首先,我在“WMAppManifest.xml”中找到了ID\u CAP\u ISV\u CAMERA功能所需的信息(在同一页上)。但我在添加它时遇到问题,因为: 我在de
captureSource.Start()处停止代码>抛出System.UnauthorizedAccessException:试图执行未经授权的操作。
首先,我在“WMAppManifest.xml”中找到了ID\u CAP\u ISV\u CAMERA
功能所需的信息(在同一页上)。但我在添加它时遇到问题,因为:
我在designer中找不到此功能
当我手动将其添加到.xml文件时,会出现错误
错误如下:
Warning 1 The 'Name' attribute is invalid - The value 'ID_CAP_ISV_CAMERA' is invalid according to its datatype 'http://schemas.microsoft.com/appx/2010/manifest:ST_Capabilities' - The Enumeration constraint failed.
Error 3 App manifest validation failed. Value 'ID_CAP_ISV_CAMERA' of attribute '/Package/Capabilities/Capability/@Name' must be a valid capability.
我甚至找到了同样的解决方案
有人能告诉我为什么我不能使用原始的MSDN解决方案来解决这个问题吗?首先,看起来您试图将该功能添加到Package.appxmanifest
而不是WMAppManifest.xml
。您应该能够在解决方案资源管理器->->属性下找到WMAppManifest.xml
:
打开该文件时,您可以选择添加ID\u CAP.*
功能
第二,您需要同时指定ID\u CAP\u ISV\u摄像头
和ID\u CAP\u麦克风
,以便使用CaptureSource.Start()
,即使您只使用其中一个设备。谢谢您的回答。我没有在属性中搜索,我确信Package.appxmanifest是正确的文件(名称非常相似)。我在适当的WMAppManifest.xml
文件中找到了ID\u CAP\u ISV\u摄像头
和ID\u CAP\u麦克风
,现在它工作正常:)
Warning 1 The 'Name' attribute is invalid - The value 'ID_CAP_ISV_CAMERA' is invalid according to its datatype 'http://schemas.microsoft.com/appx/2010/manifest:ST_Capabilities' - The Enumeration constraint failed.
Error 3 App manifest validation failed. Value 'ID_CAP_ISV_CAMERA' of attribute '/Package/Capabilities/Capability/@Name' must be a valid capability.