1

I am trying to use Keyword Query object in asp.net application.

I wrote this code :

Namespace : using System.Data.SqlClient; using Microsoft.SharePoint; using Microsoft.SharePoint.Search; using Microsoft.SharePoint.Search.Query;

Page load event: GridView grd = new GridView(); DataTable dt = new DataTable(); KeywordQuery qRequest = new KeywordQuery("http://server/ril"); qRequest.QueryText = "RILLIB"; ResultTableCollection resTableCollect = qRequest.Execute(); ResultTable resTable = resTableCollect[ResultType.RelevantResults]; DataTable dtTable = new DataTable(); dtTable.Load(resTable, LoadOption.OverwriteChanges); grd.DataSource = dtTable; grd.DataBind();

Page.Controls.Add(grd);

Ok? Whe i run it gives me error : Exception from HRESULT: 0xC0041228

When i saw Logs i found these lines. What the error exactly ? how can i remove that?

Event Type: Error Event Source: Office SharePoint Server Event Category: Office Server Shared Services Event ID: 6481 Date: 05/11/2009 Time: 6:12:25 PM User: N/A Computer: SERVER Description: Application Server job failed for service instance Microsoft.Office.Server.Search.Administration.SearchServiceInstance (41fdea47-166f-4d9f-9cd0-4f3dd0f5cd5b).

Reason: Access to the path 'C:\WINDOWS\system32\drivers\etc\HOSTS' is denied.

Techinal Support Details: System.UnauthorizedAccessException: Access to the path 'C:\WINDOWS\system32\drivers\etc\HOSTS' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.IO.StreamWriter.CreateFile(String path, Boolean append) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize) at System.IO.StreamWriter..ctor(String path, Boolean append) at System.IO.FileInfo.CreateText() at Microsoft.Search.Administration.Security.HOSTSFile.CleanupDedicatedGathering(Hashtable HOSTSFileMappings, StringBuilder HOSTSComments, IEnumerable obsoleteHosts, String dedicatedName, Boolean isDirty) at Microsoft.Search.Administration.Security.HOSTSFile.ConfigureDedicatedGathering(SearchServiceInstance searchServiceInstance, SPServer dedicatedWebFrontEndServer, IList`1 previousWebApplicationHostNames) at Microsoft.Office.Server.Search.Administration.SearchServiceInstance.SynchronizeDefaultContentSource(IDictionary applications) at Microsoft.Office.Server.Search.Administration.SearchServiceInstance.Synchronize() at Microsoft.Office.Server.Administration.ApplicationServerJob.ProvisionLocalSharedServiceInstances(Boolean isAdministrationServiceJob)

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Red Swan
  • 15,157
  • 43
  • 156
  • 238
  • please read... sorry for not formatting i had no time ... next time i will keep in mind ...please help... – Red Swan Nov 05 '09 at 12:54
  • No one is going to "have the time" to answer your questions if you can't even bother to format them, or even mark the correct answer as "answered"....Seriously, 23 questions asked, many of which were clearly answered, and you marked none as such. – gn22 Nov 11 '09 at 22:18
  • sorry i didnot have to knowledge how to do that .... ans please – Red Swan Nov 17 '09 at 06:34

0 Answers0