When developing against the SharePoint object model in an application outside of IIS (service, console, Winforms etc..) you receive the error “FileNotFoundException” when creating an instance of the SPSite object.
ERROR MESSAGE:
System.IO.FileNotFoundException: The Web application at http://
If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.\n
at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)\n at Microsoft.SharePoint.SPSite..ctor(String requestUrl)\n
SOLUTION:
The user running the application needs to have the following permissions and group membership set:
· The user is a server farm administrator.
· The user has Read and Write permissions on the content database.
· The user is a site collection administrator.
· The user has permissions to access the Windows SharePoint Services site or the SharePoint Server 2007 site through which the code iterates.
REFERENCE LINK:
http://social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/thread/5834679b-482b-4924-b881-fa2146840d05/
2 comments:
Hi, im trying to develop a new application to insert users in membership and in a sharepoint group.
When i try to call the SPSite constructor, the System.IO.FileNotFoundException error when opening SPSite outside IIS error appears.
i change in the iis the users who runs the applicaton and is the same that i install the sharepoint app so i think that i do the things that you post. any idea?
One thing to remember is that the hive is your friend.
In order use the SPSite, SPWeb etc api objects from outside sharepoint there is a set of permissions necessary for the running user, not only on the sharepoint front end but also on the sharepoint databases.
The first hoop you will jump through is going into regedit and navigating to HKLM\Software\Microsoft\Shared Tools\Web Server Extensions\12.0\Secure\ConfigDB
Make sure that your user has access to that key.
The next hoop is giving your user access to the config db
The following hoop is giving your user access to the content db.
After that you will need to find all the stored procedures it needs permission to. The best way to find the permissions you need is to look in the Sharepoint log located in the hive under (C:\program files\Common Files\microsoft shared\Web Server Extensions\12\logs)
As an alternative to granting these permissions, you can also use the web service interface that sharepoint provides. Then your user only needs permissions at the sharepoint web level as opposed to database and regedit.
Here is a list of some of the available services:
http://www.crsw.com/mark/sharepoint/Wiki%20Pages/SharePoint%20Web%20Services.aspx
Hope this helps
Post a Comment