Sharepoint SPS 站点

发布于 2024-07-17 14:24:08 字数 316 浏览 7 评论 0原文

我正在尝试为共享点搜索创建对象的 spsite,但我在生产中遇到异常,因为找不到网站

SPSite site = new SPSite("sitename");
ServerContext scon = ServerContext.GetContext(site);
SearchContext srchcontext = SearchContext.GetContext(scon);
Scopes sc = new Scopes(srchcontext);

它抛出异常站点未找到我已经检查了它存在的站点的名称。

有什么帮助吗?

I am trying to create a spsite of object for sharepoint search but i am getting exception in production as website not found

SPSite site = new SPSite("sitename");
ServerContext scon = ServerContext.GetContext(site);
SearchContext srchcontext = SearchContext.GetContext(scon);
Scopes sc = new Scopes(srchcontext);

It throws exception site not found i have checked the name of site it exixts.

Any Help??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

淡淡離愁欲言轉身 2024-07-24 14:24:08

检查您是否正在针对正确的目标进行构建。 即 x86 与 x64。
当我针对 x86 构建并尝试针对 x64 运行时,我收到此错误。

Check that you are building against the correct target. I.e. x86 vs x64.
I get this error when I build against x86 and try and run against x64.

嘦怹 2024-07-24 14:24:08

您的权限设置正确吗? 看看这个对话...

http://social.msdn.microsoft.com/Forums/ja-JP/sharepointdevelopment/thread/4d923b6a-d423-4c42-82dd-3315872db9cc

您需要确保(取自上述内容):

  1. 用户是一个服务器场
    行政人员。
  2. 用户对内容数据库具有读取和写入权限。
  3. 该用户是网站集管理员。
  4. 用户有权访问代码循环访问的 Windows SharePoint Services 网站或 SharePoint Server 2007 网站。

Do you have your permissions set up correctly? Check out this conversation...

http://social.msdn.microsoft.com/Forums/ja-JP/sharepointdevelopment/thread/4d923b6a-d423-4c42-82dd-3315872db9cc

You need to ensure (taken from the above) that:

  1. The user is a server farm
    administrator.
  2. The user has Read and Write permissions on the content database.
  3. The user is a site collection administrator.
  4. The user has permissions to access the Windows SharePoint Services site or the SharePoint Server 2007 site through which the code iterates.
浪菊怪哟 2024-07-24 14:24:08

您还应该确保您使用的 IP 地址可以从本地机器和运行程序的服务器上访问。

在执行程序之前,请从 cmd 提示符 ping Web 地址。
另一种测试方法是在浏览器中从您正在执行程序的框中打开确切的网址。

您可能正在尝试从不在同一域中的服务器访问内部站点。

最后,正如 MSDN 文档 中所述您不应该使用“SiteName”,而应确保使用“SiteAbsoluteUrl”。

You should also ensure that you are using an ip address you can hit from both your local box, and the server that you are running the program on.

Before executing the program, ping the webaddress from the cmd prompt.
Another way to test it is to open up the exact webaddress in a browser from the box that you are executing the program.

It's possible you are trying to hit an internal site from a server which is not on the same domain.

And finally, as it says in the MSDN Documentation you shouldn't be using "SiteName" but rather ensure that you are using "SiteAbsoluteUrl".

魂归处 2024-07-24 14:24:08

如果您创建一个控制台应用程序并在那里尝试相同的代码,则相同的代码可以工作。 您必须将应用程序添加到 IIS 并更改应用程序池标识。 我也做了同样的事情,这对我有用。

If you create a console application and try the same code there, the same code works. You have to add application to IIS and change the app pool identity. I did the same and it worked for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文