No voice installed on the system or none available with the current security setting

℡╲_俬逩灬. 提交于 2019-12-20 02:26:10

问题


Exception on IIS Server When try to create .wav file on c# using SpeechSynthesizer.


回答1:


This error is caused when the application is unable to access a voice for the SpeechSynthesizer to use. The first possible cause is the lack of any installed voices on the system. Odds are this isn't the problem, but you should still double check by running something like the following bit of code:

SpeechSynthesizer ssTest = new SpeechSynthesizer();
System.Diagnostics.Debug.WriteLine(ssTest.GetInstalledVoices().Count);

Assuming the above returns a number higher than 0, the problem is likely a more complicated issue with your application's security settings.

Several methods in the SpeechSynthesizer class, including SetOutputToWaveFile, require the immediate caller to be fully trusted. This might not be a huge concern for a desktop application (which the SpeechSynthesizer class was likely designed for) but has more serious security repercussions in a web environment. Therefore, IIS's default settings only make applications partially trusted. There are a number of ways to change this, possibly the quickest and certainly the dirtiest way is switching the application pool's identity from the default to an account with administrator privileges like the LocalSystem account.

Once again, just for emphasis, this will seriously harm the security of your application and should be fully researched before implementing.




回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/7021200/no-voice-installed-on-the-system-or-none-available-with-the-current-security-set

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