c# - windows indexing search not working with exception. 800703fa attempted on a registry key marked for deletion -


i using windows indexing service in asp.net application full text search functionality. production server in application deployed operating system windows 2008 r2.

this full text search functionality works 4-6 hours , after time following issue occurs logged application error logging system

retrieving com class factory component clsid {7d096c5f-ac08-4f1f-beb7-5c22c517ce39} failed due following error: 800703fa illegal operation attempted on registry key has been marked deletion. (exception hresult: 0x800703fa).

issue appears in following function

public dataset searchfolder(string searchquery, string strpath) {
dataset dataset = new dataset(); if (searchquery == null || searchquery.length == 0 || strpath == null || strpath.length == 0) return dataset;

    // thie uses searchapi interop assembly     csearchmanager manager = new csearchmanager();      // systemindex catalog default catalog windows uses     csearchcatalogmanager catalogmanager = manager.getcatalog("systemindex");       // isearchqueryhelper translate aqs --> sql necessary query indexer     csearchqueryhelper queryhelper = catalogmanager.getqueryhelper();     queryhelper.querycontentlocale = 2052;     //queryhelper.querymaxresults = 100;     //queryhelper.querykeywordlocale = 2052;      //queryhelper.     // set columns want,Ö»¼ìË÷ÎļþµÄÃû×ÖºÍÄÚÈÝ£¬²»È»ÊôÐÔÌ«¶àÁË£¬»á³öÏÖ¹·Æ¨²»Í¨µÄ½á¹û¡£     queryhelper.queryselectcolumns = "system.search.rank, system.itempathdisplay,system.itemnamedisplay,system.itemnamedisplay";     queryhelper.querywhererestrictions = "and scope='file:" + strpath + "' , contains(system.itemnamedisplay, '.pdf')";     queryhelper.querysorting = "system.datemodified desc ";     // queryhelper.s     queryhelper.querycontentproperties = "system.search.contents,system.itemnamedisplay";      try     {         // create oledb command object query built above , connection opened.         //oledbcommand command = new oledbcommand(sqlquery, conn);                      //sqlquery = "select \"system.search.rank\", \"system.itempathdisplay\", \"system.itemnamedisplay\", \"system.itemnamedisplay\", \"system.search.contents\", \"system.filename\" \"systemindex\" (contains(system.search.contents,'\"cn\" , \"604\" , \"1999\"',2052) rank coercion(absolute, 1000) or (system.filename '%cn%' , system.filename '%604%' , system.filename '%1999%')) , scope='file:d:\\scs' , contains(system.itemnamedisplay, '.pdf') order system.datemodified desc "; //all         //sqlquery = "select \"system.search.rank\", \"system.itempathdisplay\", \"system.itemnamedisplay\", \"system.itemnamedisplay\", \"system.search.contents\", \"system.filename\" \"systemindex\" (contains(system.search.contents,'\"cn\" or \"604\" or \"1999\"',2052) rank coercion(absolute, 1000) or (system.filename '%cn%' or system.filename '%604%' or system.filename '%1999%')) , scope='file:d:\\scs' , contains(system.itemnamedisplay, '.pdf') order system.datemodified desc "; //         //sqlquery = "select \"system.search.rank\", \"system.itempathdisplay\", \"system.itemnamedisplay\", \"system.itemnamedisplay\", \"system.search.contents\", \"system.filename\" \"systemindex\" (contains(system.search.contents,'\"cn 604 1999\"',2052) rank coercion(absolute, 1000) or system.filename '%cn 604 1999%') , scope='file:d:\\scs' , contains(system.itemnamedisplay, '.pdf') order system.datemodified desc "; //exact                          datatable dtresults = new datatable();             dtresults.columns.add("rank", typeof(system.int32));             dtresults.columns.add("path", typeof(system.object));             dtresults.columns.add("doctitle", typeof(system.object));             dtresults.columns.add("filename", typeof(system.object));             dataset.tables.clear();             dataset.tables.add(dtresults);              byte[] bytes = system.text.encoding.default.getbytes(searchquery);             string strquerystring = system.text.encoding.utf8.getstring(bytes);             string autogeneratedquery = queryhelper.generatesqlfromuserquery(strquerystring);//queryhelper.generatesqlfromuserquery(strcontent);              populateddatatable(autogeneratedquery, queryhelper.connectionstring, dtresults);     }     catch (exception ex)     {         logerror.logerrormessage(ex);     }         { }     return dataset; } 

private static void populateddatatable(string sqlquery, string connectionstring, datatable dtresults) { system.data.oledb.oledbconnection conn = new oledbconnection(connectionstring);

    using (conn)     {         oledbcommand command = new oledbcommand(sqlquery, conn);         command.commandtimeout = 0;         conn.open();          oledbdatareader reader = command.executereader();          if (reader.hasrows)         {             while (reader.read())             {                 datarow dr = dtresults.newrow();                 dr["rank"] = reader.getint32(0);                 dr["path"] = reader.getstring(1);                 dr["doctitle"] = reader.getstring(2);                 dr["filename"] = reader.getstring(3);                 dtresults.rows.add(dr);             }         }         reader.close();               } } 

if issue can due data reader closed not disposed?how identify exact cause of issue?


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -