Sharepoint SPS 站点
我正在尝试为共享点搜索创建对象的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
检查您是否正在针对正确的目标进行构建。 即 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.
您的权限设置正确吗? 看看这个对话...
http://social.msdn.microsoft.com/Forums/ja-JP/sharepointdevelopment/thread/4d923b6a-d423-4c42-82dd-3315872db9cc
您需要确保(取自上述内容):
行政人员。
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:
administrator.
您还应该确保您使用的 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".
如果您创建一个控制台应用程序并在那里尝试相同的代码,则相同的代码可以工作。 您必须将应用程序添加到 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.