System.Speech throws “No voice installed on the system or none available with the current security setting” exception in Windows Service
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.
Simple fix: Grant read/write access to C:\windows\system32\config\systemprofile\appdata\roaming for the same user that the service is running under.
In x64 OS, this is caused by AnyCPU build configuration. Switch to x86 build configuration and it should work.
i exited Visual Studio and reopened it after it saved, and the problem was solved.