NateRickard / Xamarin.Cognitive.Speech

A client library that makes it easy to work with the Microsoft Cognitive Services Speech Services Speech to Text API on Xamarin.iOS, Xamarin.Android, UWP, and Xamarin.Forms/.NET Standard libraries used by those platforms
MIT License
59 stars 18 forks source link

Constantly gettng 'SendRequest: Non-success status received :: Status Code: ServiceUnavailable' #15

Closed bzglm closed 5 years ago

bzglm commented 5 years ago

Hi, first I want to thank you for the library, I had been looking for something similar for a while.

I am however facing the same issue over and over, I would say 95% of the times, I get the following response from the API:

Message=SendRequest: Non-success status received :: Status Code: ServiceUnavailable; Reason: ; Content: <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta content='text/html; charset=utf-8' http-equiv='content-type'/><style type='text/css'>body { font-family:Arial; margin-left:40px; }img { border:0 none; }#content { margin-left: auto; margin-right: auto }#logo { margin-top: 30px; width=120px; height=34px }#message h2 { font-size: 20px; font-weight: normal; color: #000000; margin: 34px 0px 0px 0px }#message p { font-size: 13px; color: #000000; margin: 7px 0px 0px 0px }#errorref { font-size: 11px; color: #737373; margin-top: 41px }</style><title>Bing</title></head><body><div id='content'><div id='logo'><img alt='Bing' src='data:image/gif;base64,R0lGODlheAAiAMQAAL/a9ECR3n+16e/2/BB11jCI28/j95/I7mCj5K/R8d/t+XCt5iB+2f+mFI++7FCa4f/u0/+sI/+xMZvF7v/YmP/04v/dpwBs0////wAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAB4ACIAAAX/ICCMAmaeaKqekNQ0kbXOdG3feI4JV3/ptMhrCAEaj8gcz5dECYeNYnNKNS571dYrQql6v7XrT6UAmAG5itQ2OAMUScPZkFI4HoEeYBIIOBwTXmInCQgFPogMDw5wSHZ5iD4BAnQ2BguHkRcFCwmQiGgCAAUFaFViAwIEmqwXCJUom3mmJwCfrZIHM7a4vRdoBwYjsFNiqz4ECA5nBwsMkQsDsT60Aw+RDMpmzZmSjScIkQWiAAkC3ay0YDusDLq7twXSJqAmA+gB6ii8yLDh3itGIUKwboWYHgjm1TiASB49aiY+EUhwA8CxTSbEEKzxrwfFgigObsTB0MeDh3ow/xioh2OljwQDLha4MeBZDwYgQyYysgARnHpXZur4hAAAonc2HCAiVlAM0hwKEJWo1zEAkCt+WNowCjEnOx/fdHSzWu+TVR1YuXrEobRrTlRHxmIoK+mqpAGITt6weYGAVxNqL3zUgdfHgrkQzdrtYbWnj6crOl4o8RfDxbM62qaky3jxBav3EEVbYa1h5YxHdRi4jPIXBsVo62IIjWzBGwwKCl288EBhZXSQZ6zu1xoNbCWyM+7GRSD4X9o9HoRNkQoRAVicP3vGbM8Bula9T6MonfcArdwIdhcglp37Daw0ypFI4Mk609P8fN0Mnn0kDvhAHHARAb6Jp5IzzCEwWIAKffRBxwINOkfDAQ0eZkQCAxlIGgAHkLDMdBoiIVmBIZYIUkkpmagiSBi6teKLVTjWA4gwwsgXgZawVuOOhDRE4gkGoHMfjy+i2JcABaaym4RErpjAcgEsIIAh2OjT5I5K+sIAkld2aU8CEPLFwCQA/OglkQMMoIABbCqQpokhAAA7'/></div><div id='message'><h2>Bing services aren't available right now</h2><p>We're working to restore all services as soon as possible.<br/>We know you want to get back to searching. Please check back soon.</p></div><div id='errorref'><span>Ref A: A1C0134338234D4AA480524F216CB616 Ref B: PAR02EDGE0112 Ref C: 2018-09-27T17:12:16Z</span></div></div></body></html>

I am getting this on UWP, and Android, with every possible configuration (recognition mode, streaming on/off, etc.). Every once in a while I get a succesful response from the API, but then I get this response again and I have no idea why. Any insight would be very much apprciated.

nexxuno commented 5 years ago

Same as #14 let's see if Nate comes up with some ideas, I've no clue I'll get back to debugging next week....

NateRickard commented 5 years ago

I've done a bunch more testing on my end, with these results:

Android: Readme was already updated with the following, which is still valid and resolves the issue for me (tested on emulator and an old HTC One device):

With the latest speech api we've seen the need to change your Android project to use the Android HttpClient/Handler. If you're experiencing "Service Unavailable" errors on Android, this is likely what you need to do to resolve the issue.

iOS: Now also needs to use the non-managed HttpClient implementation. I recommend NSUrlSession implementation and I was able to get consistently successful results after switching to that. Tested on simulator and iPhone 6s device.

UWP: I am not able to generate ServiceUnavailable errors when testing on UWP. I only have access to test via "Local Machine." If there is a way to reproduce this on UWP please let me know.

Remember the HttpClient implementation must be changed per build config. I.e. changing it for iPhoneSimulator is not enough, you must change it for iPhone and any other needed build config.

nexxuno commented 5 years ago

On Android today is working 9 out of 10, I swear I didn't change the code, so it must be something else maybe in the OS?

I changed the code for iOS too but I can't deploy it at the moment so I'll try it as soon as I can.

Thanks!

BeanStalka commented 5 years ago

Nate,

My project is a Xamarin Android Project.

I am getting the 'ServiceUnavailable', but only on the initial request after deploy

All subsequent request are fine.

I'm already using the Android Http Request Handler and Native TLS 1.2

Any thoughts?

Bean

nexxuno commented 5 years ago

The only hint I can give to reproduce the bug is: -Start your app under wifi -Stream an audio to the service - it works! -Switch to cellular network -Stream again - failure most of the times!


From: BeanStalka notifications@github.com Sent: Monday, October 1, 2018 7:45:23 PM To: NateRickard/Xamarin.Cognitive.BingSpeech Cc: Paolo Ferrazza; Comment Subject: Re: [NateRickard/Xamarin.Cognitive.BingSpeech] Constantly gettng 'SendRequest: Non-success status received :: Status Code: ServiceUnavailable' (#15)

Nate,

I am getting the 'ServiceUnavailable', but only on the initial request after deploy

All subsequent request are fine.

I'm already using the Android Http Request Handler and Native TLS 1.2

Any thoughts?

Bean

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNateRickard%2FXamarin.Cognitive.BingSpeech%2Fissues%2F15%23issuecomment-425998631&data=02%7C01%7C%7C2c1a4c50eee34d96466c08d627c5ab2b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636740127257209437&sdata=LNu8rTFtVaZflTpIfKXbscm2HHOtKhWLHfRiVpNxzDw%3D&reserved=0, or mute the threadhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOxBAFF2u6rPW6dF3QihZG2gW9dKlqyIks5uglSzgaJpZM4W9G7b&data=02%7C01%7C%7C2c1a4c50eee34d96466c08d627c5ab2b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636740127257209437&sdata=h2VfSo7V31ueG0ACaxWSK8ySth6HPKcBO9z%2Bwr4sye8%3D&reserved=0.

nexxuno commented 5 years ago

As a side note iOS is fixed.

nexxuno commented 5 years ago

I don't know about @BeanStalka and @bzglm but I tested this on many devices in the last days and it's working, maybe it was a problem on MS side?

NateRickard commented 5 years ago

closing this since it seems to have been resolved