FileNotFoundException异常的的SPSite构造函数。什么问题? [英] FileNotFoundException with the SPSite constructor. What's the problem?

查看:308
本文介绍了FileNotFoundException异常的的SPSite构造函数。什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试实例的SPSite的实例在定制软件(MyApp.exe将)农场服务器上,我给的参数整个网站( HTTP: // mysite的:80 / )。我还确保运行MyApp.exe的帐户是网站集管理员。

I try to instantiate a instance of SPSite on the farm server in a custom software (MyApp.exe) and I give in parameter the whole website (http://mysite:80/). I also made sure that the account running MyApp.exe is Site Collection Administrator.

不过,我不能作出的SPSite的一切,我试图做一个实例。我总是还给FileNotFoundException异常。

However, I can't make an instance of SPSite whatever I am trying to do. I always gives back "FileNotFoundException".

任何人有一个想法?

堆栈跟踪:

在   Microsoft.SharePoint.SPSite..ctor(SPFarm   农场,乌里requestUri,布尔   contextSite,SPUserToken userToken)
  在   Microsoft.SharePoint.SPSite..ctor(字符串   requestUrl)在   MyCompanyName.Service.HelperClass.GetItemStateInSharePoint(SharePointItem   项)   C:\工作区\ MyCompanyName \开发\ MAIN \ MyCompanyName.SharePoint \服务\ HelperClass.cs:行   555

at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)
at Microsoft.SharePoint.SPSite..ctor(String requestUrl) at MyCompanyName.Service.HelperClass.GetItemStateInSharePoint(SharePointItem item) in C:\Workspaces\MyCompanyName\Development\Main\MyCompanyName.SharePoint\Service\HelperClass.cs:line 555

另外一个侧面说明...我有一个Web应用程序+网站的集合,我可以通过浏览器访问没有任何问题。

Another side note... I have a Web Application + Site collection that I can access through the browser without any problem.

推荐答案

该FileNotFoundException异常被抛出的SharePoint时,它无法找到在SharePoint配置数据库中请求网站集。我的猜测是,你还没有创建的网站集的URL 的http:// mysite的:80 。我看到下面的堆栈跟踪,如果我尝试实例化一个新SPSite对象与非现有网站集的URL:

The FileNotFoundException is thrown by SharePoint when it cannot find the requested site collection in the SharePoint configuration database. My guess is that you have not yet created a site collection on the URL http://mysite:80. I see the following stack trace if I try and instantiate a new SPSite object with the URL of a non-existing site collection:

System.IO.FileNotFoundException : The site http://server/sites/bah could not be found in the Web application SPWebApplication 
Name=SharePoint - 80 Parent=SPWebService.
at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)
at Microsoft.SharePoint.SPSite..ctor(String requestUrl)

指定的网站集或打开管理中心正确的URL,并创建一个新的网站集。

Specify the proper URL of your site collection or open Central Administration and create a new Site Collection.

这篇关于FileNotFoundException异常的的SPSite构造函数。什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆