Closed kushal713 closed 8 years ago
@kushal713 : OK, sounds like your code is pretty good (since it works locally) and this is related to your deployment to the server. I've got a few questions that will help find the issue.
From the stacktrace, I have a hunch this might be related to serving multiple requests at once on the web server, something like
Hi Ken, Thanks for responding on this. Below are the answers to your questions:-
https://api.yelp.com/v2/search?term=food&location=San+Francisco
But then the IT Team installed some yelp certificates and now it opens fine.
Hope I have answered your questions appropriately. Please let me know if you have any other questions.
Also, I am not using Task Parallel Library(TPL) anywhere in my code, as suggested by the link shared by you. Can this be related to the async call?
Hm, no clean answer yet.
Next:
Unexpected character encountered while parsing value: <, Path ''...
sounds like you're getting an HTML page instead of a JSON response. What HTTP status code does the response have? 200, 404, 500, etc? What's the response body? You should be able to add diagnostics to your code to show this if it's not visible in your debugger.
Yes. I was getting the error even before installing the Yelp certificates. But the InnerException in that case was different. It was a Newtonsoft.Json.JsonTextReader.Read() InnerException then. After installing the certificate, the InnerException has changed from Newtonsoft.Json to mscorlib. But the main error is the same. I figured that the response is HTML instead of JSON, which means the call is not being made properly. But what can be the workaround to this? It cant be a Key issue as it would not be going into Exception. It would just be an INVALID_OAUTH error then,
Hi, I debugged the dll and it sends the StatusCode as 'NotAcceptable'. This is the response.Content:-
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n
\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"/>\r\n
Hi, I am running the following Yelp c# call on my local machine and it works perfectly fine:- var results = y.Search(searchOptions).Result;
However, when I host the code on the server, this very line returns the following exception:- Message: One or more errors occurred. Source: mscorlib STackTrace: at 'System.Threading.Tasks.Task.ThrowIfExceptional(Boolean include TaskCancelledExceptions)\r\n at System.Threading.Tasks.Task 1.GetResultCore.......
I have also attached a screenshot of the same. Kindly help me in this as its driving me crazy.