SpeechSynthesizer in ASP.NET - async error
I would like to be able to generate speech in my ASP.NET app by calling speak.aspx?text=Hello%20world . This would give a response in .wav format. So far I have a blank page with code behind: protected void Page_PreRender(object sender, EventArgs e) { using (var ss = new SpeechSynthesizer()) { MemoryStream str = new MemoryStream(); ss.SetOutputToWaveStream(str); ss.Speak(Server.UrlDecode(Request.QueryString["text"])); Response.AddHeader("Content-Type", "audio/wav"); str.WriteTo(Response.OutputStream); str.Close(); } } However this fails with message: InvalidOperationException : Asynchronous