在初始化时SpeechSynthesizer UnauthorizedAccessException [英] UnauthorizedAccessException when initializing SpeechSynthesizer

查看:327
本文介绍了在初始化时SpeechSynthesizer UnauthorizedAccessException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用微软SpeechSynthesizer为我的Windows Phone应用程序创建音频输出。我使用此代码



 专用异步无效TextToSpeech_Tap(对象发件人,System.Windows.Input.GestureEventArgs E)
{
SpeechSynthesizer合成=新SpeechSynthesizer();

等待synth.SpeakTextAsync(你必须在15分钟内与Peter开会。);
}



我得到这个异​​常:

  {System.UnauthorizedAccessException的:访问被拒绝。 

在Windows.Phone.Speech.Synthesis.SpeechSynthesizer..ctor()
在NerdQuiz.Question< TextToSpeech_Tap> d__1.MoveNext()
---完从以前的位置,引发异常---
在System.Runtime.CompilerServices.AsyncMethodBuilderCore<堆栈跟踪; ThrowAsync> b__0(对象状态)}

我发现,在

 新SpeechSynthesizer() ; 


解决方案

请确保您已经添加的能力 ID_CAP_SPEECH_RECOGNITION 应用程序清单(WMAppManifest.xml)。


I'm using Microsofts SpeechSynthesizer to create audio output for my Windows Phone app. I use this code

private async void TextToSpeech_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
    SpeechSynthesizer synth = new SpeechSynthesizer();

    await synth.SpeakTextAsync("You have a meeting with Peter in 15 minutes.");
}

I get this exception:

{System.UnauthorizedAccessException: Access is denied.

at Windows.Phone.Speech.Synthesis.SpeechSynthesizer..ctor()
at NerdQuiz.Question.<TextToSpeech_Tap>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__0(Object state)}

I found out that the error occurs at

new SpeechSynthesizer();

解决方案

Make sure you have added the capability ID_CAP_SPEECH_RECOGNITION to the application manifest (WMAppManifest.xml).

这篇关于在初始化时SpeechSynthesizer UnauthorizedAccessException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆