C# 在windows服务中打开spweb

C# 在windows服务中打开spweb,c#,sharepoint-2010,C#,Sharepoint 2010,我想检查SharePoint库中的文档属性。请告诉我如何在windows服务中打开SharePoint网站。 我在windows服务中使用以下代码,它给出了“站点未找到错误” 细节错误是 System.IO.FileNotFoundException: The Web application at http://xyz/sites/abc could not be found. Verify that you have typed the URL correctly. If the URL sh

我想检查SharePoint库中的文档属性。请告诉我如何在windows服务中打开SharePoint网站。 我在windows服务中使用以下代码,它给出了“站点未找到错误”

细节错误是

System.IO.FileNotFoundException: The Web application at http://xyz/sites/abc could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
   at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(String requestUrl)
   at SSP_DL_notify_service.Service1.GetMail(Object sender, ElapsedEventArgs args) in C:\Users\pqr\Documents\Visual Studio 2010\Projects\SSP_DL_notify_service\SSP_DL_notify_service\Service1.cs:line 54
你的代码很好

您确定
http://xyz/sites/abc
是一个站点吗?URL正确吗

如果URL正确,请检查您是否具有打开该URL所需的权限

编辑:


同时检查此线程:

这里我给出了虚拟url,我们可以在windows服务中打开spsite吗?是的,从技术上讲这是可能的。谢谢,但我在windows服务中运行相同的服务,它会导致站点未发现异常。我还检查了权限。您的服务使用哪个帐户运行(检查服务属性中的登录选项卡)?检查我在上次编辑中提到的线程-也许它会对您有所帮助。
System.IO.FileNotFoundException: The Web application at http://xyz/sites/abc could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
   at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(String requestUrl)
   at SSP_DL_notify_service.Service1.GetMail(Object sender, ElapsedEventArgs args) in C:\Users\pqr\Documents\Visual Studio 2010\Projects\SSP_DL_notify_service\SSP_DL_notify_service\Service1.cs:line 54