我正在尝试在 asp.net 应用程序中使用关键字查询对象。
我写了这段代码:
命名空间:使用System.Data.SqlClient;
使用 Microsoft.SharePoint;
使用 Microsoft.SharePoint.Search;
使用 Microsoft.SharePoint.Search.Query;
页面加载事件:
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];
数据表 dtTable = new 数据表();
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(字符串路径,FileMode模式,FileAccess访问,Int32权限,布尔useRights,FileShare共享,Int32 bufferSize,FileOptions选项,SECURITY_ATTRIBUTES secAttrs,字符串msgPath,布尔bFromProxy)
在 System.IO.FileStream..ctor(字符串路径、FileMode 模式、FileAccess 访问、FileShare 共享、Int32 bufferSize、FileOptions 选项)
在 System.IO.StreamWriter.CreateFile(字符串路径,布尔追加)
在 System.IO.StreamWriter..ctor(字符串路径,布尔追加,Encoding 编码,Int32 bufferSize)
在 System.IO.StreamWriter..ctor(字符串路径,布尔追加)
在 System.IO.FileInfo.CreateText()
在 Microsoft.Search.Administration.Security.HOSTSFile.CleanupDedicatedGathering(哈希表 HOSTSFileMappings、StringBuilder HOSTSComments、IEnumerable obsoleteHosts、字符串专用名称、布尔值 isDirty)
在Microsoft.Search.Administration.Security.HOSTSFile.ConfigureDedicatedGathering(SearchServiceInstance searchServiceInstance,SPServer专用WebFrontEndServer,IList`1 previousWebApplicationHostNames)
在 Microsoft.Office.Server.Search.Administration.SearchServiceInstance.SynchronizeDefaultContentSource(IDictionary 应用程序)
在 Microsoft.Office.Server.Search.Administration.SearchServiceInstance.Synchronize()
"
有关详细信息,请参阅帮助和支持中心:http://go.microsoft.com/fwlink/events.asp。
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.
发布评论