Invalid APP ID ver1.1/2.0

Terkunci Invalid APP ID ver1.1/2.0

  • 18 Januari 2009 15:18
     
     
    I copied the sample from http://msdn.microsoft.com/en-us/library/bb251808.aspx and its not working. I read that this was due to version 2.0 APP ID for version 1.1 library since it was downloaded after Nov. 13th. Is there any fix for that now that'll get search up and running? should i use a ver 1.1 APP ID (how do i get one)?
    thanks,
    dilip

Semua Balasan

  • 19 Januari 2009 13:20
     
     
    btw, I'm using Visual C# 2008 express on windows vista 32 bit.
    thanks
  • 19 Januari 2009 16:25
    Pemilik
     
     

    The fix is trivial - just remove the 1.1 code from the app and replace it with the 2.0 code that you find all over the documentation. We chose deliberately to publish the sample in installments (one code sample for every sourcetype) rather than a monolithic code project that ends up quite unwieldy.

     

    HTH

     

    --Alessandro

     

  • 20 Januari 2009 1:18
     
     Jawab
    Thanks. I will do that
  • 22 Januari 2009 13:57
     
     
    I tried a sample code from somewhere, here's the code, its giving me and error.

    EXCEPTION/ERROR:
    System.Web.Services.Protocols.SoapException: Client Error
       at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       at ApiSamples.net.live.search.api.MSNSearchService.Search(SearchRequest Request) in C:\Users\dilip\Documents\Visual Studio 2008\Projects\ApiSamples\ApiSamples\Web References\net.live.search.api\Reference.cs:line 79
       at ApiSamples.Window1..ctor() in C:\Users\dilip\Documents\Visual Studio 2008\Projects\ApiSamples\ApiSamples\Window1.xaml.cs:line 42

    CODE:
    try
                {
                    MSNSearchService serv = new MSNSearchService();
                    SearchRequest sRequest = new SearchRequest();
                    SourceRequest[] sr = new SourceRequest[1];

                    sr[0] = new SourceRequest();
                    sr[0].Source = SourceType.Web;
                    sr[0].ResultFields = ResultFieldMask.All;
                    sRequest.Query = "Live Search Articles";
                    sRequest.Flags = SearchFlags.None;
                    sRequest.Requests = sr;

                    // Replace with your own Application ID
                    sRequest.AppID = "EE4C446E3A84854D3F4C6ED246BFF78E7A91D1BD";
                    sRequest.CultureInfo = "en-US";
                    SearchResponse c = serv.Search(sRequest);

                    foreach (Result r in c.Responses[0].Results)
                    {
                        string title, description, url;
                        title = (!String.IsNullOrEmpty(r.Title))
                          ? r.Title : "";
                        description =
                          (!String.IsNullOrEmpty(r.Description))
                          ? r.Description : "";
                        url = (!String.IsNullOrEmpty(r.Url))
                          ? r.Url : "";
                    }
            
                }
                catch (Exception ex)
                {
                    textBox1.Text = ex.ToString();
                }
    Line 79 is after all the code, its wierd
    Line 42 is SearchResponse c = serv.Search(sRequest)

    Anyone know why? 
    thanks,
    dilip
  • 23 Januari 2009 2:51
    Pemilik
     
     Jawab

    Hi Dilip

     

    The code sample above is for the API 1.1 version. But the AppID used above is a version 2.0 AppID. Please use this appID with the version 2.0 code sample from this location http://msdn.microsoft.com/en-us/library/dd251049.aspx.

    Also, this link http://msdn.microsoft.com/en-us/library/dd250965.aspx might help.

     

    Thanks!

     

     

     

  • 24 Januari 2009 4:55
     
     
    thanks for the reply, but i have a problem still...
    I put this in the Window1.xaml.cs of a windows form in VC#. Should i do this? because when i do this and add the web refernce, it creates a code in App.g.cs. The code in App.g.cs and Window1.xaml.cs both have a Main method, so the code gives me ther error: "Program has more than one entry point" or something like that. I tried changing the name of the methods, but this doesn't work, any suggestions?
    thanks in advance,
    dilip