Before you start researching and reading about the documents, please note there are many documents and sample projects used the api.projectoxford.api endpoint, and this endpoint is retiring on January 17, 2017, and you should use speech.platform.bing.com endpoint instead.
In the REST API library, I wish the documentation can be written by someone other than the developers who involved with the cognitive service because many things are not that clear unless you become experience with it. For example, “Your application must indicate the end of the audio to determine start and end of speech….” So how do you indicate the end of the audio? How about say “The End” in the voice audio? No, I think I’ll assume a short moment of “no voice” or quite which indicates the end of audio. In this API, you should break your audio file into segments, and send each segment to the REST API to process it. Each segment is a complete .wav file, not bytes chunk, and it has a limit of 10 seconds of audio in one request. This means that each length of speech needs to be less than 10 seconds. I used 9 seconds for my app, or else you will see the unserviceable error. The duration of this request cannot exceed 14 second of processing time, which means that the API will abort itself once it exceeds that limit.
The sample code provided by Microsoft can be found here. In my web application, I used the latest System.Net.Http. HttpClient class, instead of HttpWebRequest class shown on the sample to connect the API service. But before you made the switch, you should be familiar with asynchronous programming especially if you are building your own Web API pipes for your web applications.
var token = MicrosoftAuthentication.GetNewToken();
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);
client.DefaultRequestHeaders.TransferEncodingChunked = true;
client.BaseAddress = new Uri(requestUri);
var response = await client.PostAsync(requestUri, fileContent).ConfigureAwait(false);
Below is a snapshot of my web application that I developed: