Azure Bing Search Support Team,
I'm pretty frustrated with the Azure Bing Search API testing I've done from my Silverlight app. Pretty much used the version shown in the Migration Guide as seen below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Data.Services.Client;
namespace BingAPI
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
var bingContainer = new Bing.BingSearchContainer(new Uri("https://api.datamarket.azure.com/Bing/Search/"));
// replace this value with your account key
var accountKey = "My account key inserted here";
// the next two lines configure the bingContainer to use your credentials.
bingContainer.Credentials = new NetworkCredential(accountKey, accountKey);
// note, this line was not required for the C# console app
bingContainer.UseDefaultCredentials = false;
// the next two lines define the request for data and
var Query = bingContainer.Web("newfoundland", null, null, null, null, null, null, null);
Query.BeginExecute(new AsyncCallback(
delegate(IAsyncResult ar)
{
var QueryResult = (DataServiceQuery<Bing.WebResult>)ar.AsyncState;
var Results = QueryResult.EndExecute(ar);
var resultsList = Results.ToList();
foreach (var result in resultsList)
{
// do something with the result, or bind the result
}
}), Query);
}
}
}
Garden variety Silverlight. But:
1. More than 90% of first time searches time-out with a DataServiceExceptionQuery after 20 to 30 secs.
2. After than first time query, subsequent queries using the same search term work albeit with very poor response times.
What's going on? If there's something I can do to improve my SL App please let me know. I migrated from Bing API 2.0 for my commericial product, and frankly, right now would not release a version with the Azure API based on what I've seen so far.
Help!!
Clyde