尝试进行Bing搜索. [英] Trying to make a Bing search.

查看:93
本文介绍了尝试进行Bing搜索.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉打扰你们,但是我已经尝试了两天了.我目前正在尝试按照您在http://www.codeproject.com/KB/cs/BingSearch.aspx上的示例进行操作,因此我无法克服此错误


使用(LiveSearchService服务=新的LiveSearchService())
{

找不到类型或名称空间名称"LiveSearchService"(您是否缺少using指令或程序集引用?)


现在创建| LiveSearchPortTypeClient |的对象这是基本的Endpoint类.

假设这是我做错的地方,因为我确实知道如何创建Endpoint类:




-布赖恩






I''m really sorry to bother you guys but I''ve been trying for two days now. I am currently trying to follow your example at http://www.codeproject.com/KB/cs/BingSearch.aspx and I am cannot go past this error


using (LiveSearchService service = new LiveSearchService())
{

The type or namespace name ''LiveSearchService'' could not be found (are you missing a using directive or an assembly reference?)


now create an object of |LiveSearchPortTypeClient| which is the basic Endpoint class.

Assume this is where I went wrong,because I do know to how to create an Endpoint class:




- Brian






using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using WindowsFormsApplication2.BingService;


namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        // Replace the following string with the AppId you received from the
        // Bing Developer Center.
        const string BingMapsKey = "xxxxxx";


        private void btnTranslate_Click(object sender, EventArgs e)
        {
            string strTranslatedText = null;
            try
            {
                TranslatorService.LanguageServiceClient client = new TranslatorService.LanguageServiceClient();
                client = new TranslatorService.LanguageServiceClient();
                strTranslatedText = client.Translate("xxxxxx", txtTraslateFrom.Text, "es", "en");
                txtTranslatedText.Text = strTranslatedText;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
        }
        public string SearchOutput(string AppId, string query, int offset, int no_of_res)
        {
            using (LiveSearchService service = new LiveSearchService())
            {
                try
                {
                    SearchRequest request = new SearchRequest();
                    request.AppId = AppId;
                    request.Query = query;
                    request.Sources = new SourceType[] { SourceType.Web }; //You may specify multiple
                    request.Version = "2.0";
                    request.Market = "en-us";
                    request.Adult = AdultOption.Moderate;
                    request.AdultSpecified = true;
                   // request.Web = new WebRequest();
                    //request.Web.Count = no_of_res;
                    //request.Web.CountSpecified = true;
                    //request.Web.Offset = offset;
                    //SearchResponse response = service.Search(request);
                   // return GetResponsestring(response);
                }
                catch (Exception ex)
                {
                    return ex.Message;
                }
            }
        }



    }

    }

推荐答案

Google找到了此内容- [ ^ ]
Google found this - a walkthough on how to make a Bing search.[^]


按照Google范例操作不起作用.
Following the Google Example does not work..


如果您认为LiveSearchPortTypeClient错了,那么根据文章,在添加服务引用时,您必须从LiveSearchSerice节点中选择LiveSearchPortTypeClient.
If you think that you went wrong with LiveSearchPortTypeClient, then as per the article, while Adding a service reference you have to choose LiveSearchPortTypeClient from LiveSearchSerice node.


这篇关于尝试进行Bing搜索.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆