1

我正在尝试在 asp.net 应用程序中使用关键字查询对象。

我写了这段代码:

命名空间:使用 System.Data.SqlClient;使用 Microsoft.SharePoint;使用 Microsoft.SharePoint.Search;使用 Microsoft.SharePoint.Search.Query;

页面加载事件:GridView grd = new GridView(); 数据表 dt = 新数据表();KeywordQuery qRequest = new KeywordQuery(" http://server/ril "); qRequest.QueryText = "RILLIB"; ResultTableCollection resTableCollect = qRequest.Execute(); 结果表 resTable = resTableCollect[ResultType.RelevantResults]; 数据表 dtTable = new DataTable(); dtTable.Load(resTable, LoadOption.OverwriteChanges); grd.DataSource = dtTable; grd.DataBind();

Page.Controls.Add(grd);

好?当我运行它时出现错误:HRESULT 异常:0xC0041228

当我看到日志时,我发现了这些行。究竟是什么错误?我怎样才能删除它?

事件类型:错误事件源:Office SharePoint Server 事件类别:Office Server 共享服务事件 ID:6481 日期:2009 年 5 月 11 日时间:下午 6:12:25 用户:不适用计算机:服务器描述:应用程序服务器作业失败对于服务实例 Microsoft.Office.Server.Search.Administration.SearchServiceInstance (41fdea47-166f-4d9f-9cd0-4f3dd0f5cd5b)。

原因:对路径“C:\WINDOWS\system32\drivers\etc\HOSTS”的访问被拒绝。

技术支持详细信息:System.UnauthorizedAccessException:对路径“C:\WINDOWS\system32\drivers\etc\HOSTS”的访问被拒绝。在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 在 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)在 System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize) 在 System.IO.FileInfo 的 System.IO.StreamWriter..ctor(String path, Boolean append)。

有关详细信息,请参阅http://go.microsoft.com/fwlink/events.asp上的帮助和支持中心。

4

0 回答 0