音声合成がSetVoice()に失敗しました。試行されるまで、すべてが有効にリストされ、デフォルト以外の2つが「無効」としてリストされて失敗します。SpeechSynthesisがASP.NETでSelectVoiceに失敗しましたか?
注:これはWPFまたはコンソールアプリケーションでは機能しますが、ASP.NETアプリケーションとしては機能しません。 ALSO:スピーチは、ASP.NETアプリケーション用のメインスレッドを永久にロックするため、代替スレッド(Task.Run(()=> StartSpeech())で作成されます。詳細はNo response to a HTTP Get request in WebAPI in .NET 4.5 while using SpeechSynthesis for converting text to speechを参照してください。両方の代替スレッドだけでなく、メイン。
アイデア?
private SpeechSynthesizer speech; //System.Speech.Synthesis
var voices = speech.GetInstalledVoices();
//[0]: "Microsoft David Desktop" ["Enabled"]
//[1]: "IVONA 2 Emma" ["Enabled"]
//[2]: "Microsoft Zira Desktop" ["Enabled"]
try
{
speech.SelectVoice("Microsoft Zira Desktop");
}
catch (Exception e)
{
var p = e; //fails (System.ArgumentException: Cannot set voice. No matching voice is installed or the voice was disabled)
}
voices = speech.GetInstalledVoices();
//[0]: "Microsoft David Desktop" ["Disabled"]
//[1]: "IVONA 2 Emma" ["Enabled"]
//[2]: "Microsoft Zira Desktop" ["Disabled"]
speech.SpeakAsync(text);
こんにちはジム、あなたのローカルマシンやプロダクションで失敗していますか? – Thomas
wpf/console appsがうまく動作するローカルマシン。 – Jim
トーマス - あなたは権利/プロセスについて考えてくれました...新しい情報:それはIISのみでは失敗します。ローカルで実行する(VS-f5-iis-express) - 動作します。奇妙な – Jim