System.Speech throws “No voice installed on the system or none available with the current security setting” exception in Windows Service

匿名 (未验证) 提交于 2019-12-03 01:23:02

问题:

Long time reader, first time poster.

I'm developing a Windows Service in C# .Net 3.5 to perform Text to Speech operations.

I'm using System.Speech (Microsoft Speech API 3.x).

I deployed the service to a Win2008 x64 server and it's now throwing the following exception:

System.InvalidOperationException: No voice installed on the system or none available with the current security setting.    at System.Speech.Internal.Synthesis.VoiceSynthesis.Speak(Prompt prompt)    at System.Speech.Synthesis.SpeechSynthesizer.Speak(Prompt prompt)    at System.Speech.Synthesis.SpeechSynthesizer.Speak(String textToSpeak) 

The service is running under a domain account. If I change the service to run under my own personal domain account (which has pretty high privileges), everything works perfectly (so a voice [Anna] is definitely installed). So I'm quite certain it's a security issue.

What permissions/modifications do I need to make to the other domain account to make this work?

And it needs to be this specific user because it's used for Windows auth for a MSSQL database.

Thanks in advance.

回答1:

Simple fix: Grant read/write access to C:\windows\system32\config\systemprofile\appdata\roaming for the same user that the service is running under.



回答2:

In x64 OS, this is caused by AnyCPU build configuration. Switch to x86 build configuration and it should work.



回答3:

i exited Visual Studio and reopened it after it saved, and the problem was solved.



回答4:

Simply, run the app as "administrator". ;)



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