Web Api is not returning after action is successfully invoked.
Here is the action I am trying to Invoke
public class TestController : ApiController{
public string[] Get()
{
string[] names = new string[3] {"Matt", "Joanne", "Robert"};
using (SpeechSynthesizer ss = new SpeechSynthesizer())
{
ss.Rate = -2;
var word = "Test This Two";
var filePath = HttpContext.Current.Request.MapPath("~/Content/sounds/" + word + ".wav");
ss.SetOutputToWaveFile(filePath);
ss.Speak(word);
ss.SetOutputToNull();
ss.Dispose();
}
return names;
}
}
From the browsers perspective, the page continues to cycle, waiting for a response, after this method has successfully returned the string array.
Does anyone know why this method is not returning results to the browser? Is it possible that an asynchronous thread is still running? I have debugged this method and it is invoked and returns successfully.
Cheers,
robNo.
Update
This is a test, and I am expecting the results to contain the static array. All I am trying to accomplish is making sure I can use the System.Speech assembly on my hosting environment, but first I am trying to make it work locally.
Update 2
I commented out the using statement and I successfully received the static array as xml in the browser. Therefore, its the System.Speech code that is causing the problems
I did finally received an error message on the browser: An asynchronous module or handler completed while an asynchronous operation was still pending.
This error is odd to me, because according to what I can gathered from MSDN, the SpeechSynthesizer methods I am using are synchronous, which is what I want.