none
Cannot get search result from Bing Search API

    Question

  • var bingContainer = new Bing.BingSearchContainer(
                  new Uri("https://api.datamarket.azure.com/Bing/Search/"));

                var accountKey = "MY ACCOUNT KEY";

                bingContainer.Credentials = new NetworkCredential(accountKey, accountKey);

                var webQuery = bingContainer.Web("google", null, null, null, null, null, null, null);
                webQuery = webQuery.AddQueryOption("$top", 10);
                var webResults = webQuery.Execute();

    I would like to ask why I cannot get any result using above code in c#. var webResults = webQuery.Execute() always threw exception. And always display base = {"The XmlReader must be on a node of type Element instead of a node of type None."}.

    Can anyone please help me to solve it? I get this problem for 3 days. :(

    Thursday, January 02, 2014 10:24 AM

Answers

All replies

  • Hello,

    Thanks for posting!

    According to your error information, I guess your reference ("DataServiceQuery") may have some thing wrong.

    Please check your "System.Data.Services.Client.dll"'s version is above V4 and was added rightly.Also, I suggest you could use the latest SDK and re-add your service DLL file. You could download Bing Search API sample from this page(http://code.msdn.microsoft.com/windowsazure/How-to-use-bing-search-API-4c8b287e) and try again.

    Please try it.

    Hope it helps.

    Will


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, January 03, 2014 5:51 AM
  • Thanks for you reply. I have fixed the problem. it was due to the reason that I did not read the executed result using foreach or else. :)
    Friday, January 03, 2014 6:16 AM