QueryInterface for interface Microsoft.Windows.DesktopSearch.Query.ISearchDesktop failed.

My approach is to access C# class (QueryBuilder.cs which is in Microsoft WDS sample) from asp.net application through vb.net class.

I m getting folliwng error message on web page when i am running the query. Please let me know any way to overcome this.

Server Error in '/wSearch' Application.

Answer this question

QueryInterface for interface Microsoft.Windows.DesktopSearch.Query.ISearchDesktop failed.

  • Gopinath M

    I finally found a solution, but I don't know if it fixes your problem Safwan. Add

    ASPCompat="true"

    to your page directive.

    It runs the page in an STA thread pool. Works fine for me apart from the lack of performance which is associated with the changes.

    Regards

    Marius


  • like_antani

    I have the same problem while trying to convert the SDK-Sample to an asp-Website.

    I searched quite a lot but still found no solution.

    Source Error:

    Line 127:			filterclaus = "Contains(PerceivedType,'" + filterclaus + "')";
    Line 128:
    Line 129:			myRecordSet = mySDObj.ExecuteQuery(query, columns, sortColumn, filterclaus);
    Line 130:			resultTable.Clear();
    Line 131:			dbAdapter.Fill(resultTable, myRecordSet);

    Stack Trace:

    [InvalidCastException: QueryInterface for interface Microsoft.Windows.DesktopSearch.Query.ISearchDesktop failed.]
    Microsoft.Windows.DesktopSearch.Query.SearchDesktopClass.ExecuteQuery(String lpcwstrQuery, String lpcwstrColumn, String lpcwstrSort, String lpcwstrRestriction) +0
    Microsoft.Windows.DesktopSearch.SampleWrapper.QueryBuilder.ExecuteQuery(String query, String filterclaus) in c:\inetpub\wwwroot\desktopsearchweb\querybuilder.cs:129
    DesktopSearchWeb.DesktopSearchWeb.runQuery() in c:\inetpub\wwwroot\desktopsearchweb\desktopsearchweb.aspx.cs:96
    DesktopSearchWeb.DesktopSearchWeb.search_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\desktopsearchweb\desktopsearchweb.aspx.cs:67
    System.Web.UI.WebControls.Button.OnClick(EventArgs e)
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    System.Web.UI.Page.ProcessRequestMain()

    Windows Desktop Search Version: 2.05.0001.1119

    I'm working on a local IIS. Maybe someone has a hint or bumps me on the noggin.


  • mosoccer

    After adding the directive ASPCompat="true" I am getting error below. not sure where to give the access permission.

    If you have any idea pls help me.

    Whole directive is as below.

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="wSearch.WebForm1" ASPCompat="true"%>

    Thanks,

    -Safwan

    Server Error in '/wSearch' Application.

  • Rob123qwe123

    Did you configure your Web.config

    <authentication mode="Windows"/>

    <identity impersonate="true" userName="<DOMAIN\USER>" password="XXXXXX"/>

    Maybe that will help.

    Regards

    Marius


  • QueryInterface for interface Microsoft.Windows.DesktopSearch.Query.ISearchDesktop failed.