1

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.

user2041334
  • 11
  • 1
  • 4

4 Answers4

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.

More Info: Tested on Windows 10 Framework 4.6.2: Microsoft Speech needs file read/write access to the "roaming" folder in order to create the ...\roaming\Microsoft\Speech folder to store files there.

If your service user is not a member of a group that has read/write access to the following registry keys, you may need to add these rights as well:

For the following, include WOW6432Node for 32 bit apps, leave it out for 64 bit apps

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\SPEECH\Voices\Tokens(VOICE NAME)

Example: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\SPEECH\Voices\Tokens\TTS_MS_EN-US_DAVID_11.0

and:

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\SPEECH\Voices\Tokens(VOICE NAME)\Attributes

Example: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\SPEECH\Voices\Tokens\TTS_MS_EN-US_DAVID_11.0\Attributes

You may need to switch the owner of these registry keys away from TrustedInstaller to your user, or the administrators group , to make these changes

If your application runs under IIS, add the above rights for the application pool user.

Community
  • 1
  • 1
BG100
  • 4,481
  • 2
  • 37
  • 64
0

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

Ondřej
  • 1,645
  • 1
  • 18
  • 29
0

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

John1990
  • 29
  • 1
  • 7
-1

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

error run as administrator

Pran
  • 1,817
  • 23
  • 23