Bing Search API示例代码不起作用

时间:2013-09-15 22:14:39

标签: c# bing-api

有人有Bing API C#示例代码有效吗?我在这个页面上引用了Web示例:https://skydrive.live.com/view.aspx?resid=9C9479871FBFA822!112&app=Word&authkey=!ANNnJQREB0kDC04

我也在使用BingSearchContainer.cs文件

string rootUri = "https://api.datamarket.azure.com/Bing/Search";

var bingContainer = new Bing.BingSearchContainer(new Uri(rootUri));

var accountKey = "Zasjkdhfkajshdfkjhasdkfjhetc";

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

// Build the query:
// Example says "var webQuery = .... I just tried this
DataServiceQuery<WebResult> webQuery = bingContainer.Web("Testing", null, null, null, null, null, null, null);

// This returns a 403
// Example says "var results = .... I just tried this too...
IEnumerable<WebResult> results = webQuery.Execute();

我也尝试过这样的事情:

bingContainer.IgnoreMissingProperties = true;

......但这没有任何区别......

谢谢。

1 个答案:

答案 0 :(得分:1)

你订阅了使用bing api吗?请检查以下链接并根据您的要求订阅

https://datamarket.azure.com/dataset/5BA839F1-12CE-4CCE-BF57-A49D98D29A44