locked
FileNotFoundException : The Web application at http://<sharepointsite> could not be found RRS feed

  • Question

  • I am getting the below exception when i am creating the SPSite instance in the webservice.

     

    I have deployed a webservice on the sharepoint server which will perform actions on the documents in the sharepoint site.

    I call the web methods from the client and get the result from sharepoint. I am getting exception when i do the webservice call from the client. When i traced the issue it is throwing below exception while createing SPsite instance.

     

    "System.IO.FileNotFoundException: The Web application at http://<sharepointsite> 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.\n  

    at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)\n at Microsoft.SharePoint.SPSite..ctor(String requestUrl)\n  

    at DMSSharepointService.DownloadFile(String siteCollection, String subSite, String folderPath, String fileName, String spCredentials)" 

     

     

    Could anyone please help in making me understand the issue. Any help is highly appreciated.

    Friday, March 14, 2008 3:51 PM

Answers

  •  

    I think we are not dumb as we are able to trace the issue that occured by giving the wrong URL or by doing the wrong configuration.

     

    The issue got fixed. The problem is that the application pool is having the default identity to Network Service. As my sharepoint database is on the other server the Network service will not have access to database. I modified the identity account to the user account which is having access to the sharepoint database. It worked and my problem solved.

    Saturday, March 15, 2008 6:31 AM
  • Are you running your code outside of IIS?

     

    If so see the FAQ http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3479387&SiteID=1

     

    Problem

    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.

    Resolution

    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. 

     

     

    Tuesday, June 24, 2008 12:42 PM

All replies

  • Maybe you're not as dumb as I am, but I occasionally get this message when I'm trying to use the wrong machine's url when creating an SPSite object.  If I'm on machine A and I try SPSite site = new SPSite("http://machineB/") I get a similar error.  I found it's pretty easy to make that mistake when you have a couple machines you're working on.

     

     

    Friday, March 14, 2008 9:13 PM
  •  

    I think we are not dumb as we are able to trace the issue that occured by giving the wrong URL or by doing the wrong configuration.

     

    The issue got fixed. The problem is that the application pool is having the default identity to Network Service. As my sharepoint database is on the other server the Network service will not have access to database. I modified the identity account to the user account which is having access to the sharepoint database. It worked and my problem solved.

    Saturday, March 15, 2008 6:31 AM
  • Hi,

     

    I am working on the same computer where WSS is installed.

    I still get the above mentioned FileNotFound Exception .

    I am the only user on the WSS server and have full control on it.

     

    Also, I have come across something called Alternate Access Mappings inorder to get rid of this Exception, what does this mean exactly ?

     

    Thank You,

    Sudhe

     

    Tuesday, June 24, 2008 10:58 AM
  • Are you running your code outside of IIS?

     

    If so see the FAQ http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3479387&SiteID=1

     

    Problem

    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.

    Resolution

    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. 

     

     

    Tuesday, June 24, 2008 12:42 PM
  •  

    Hi ,

     

    Michael thank you for the reply.

     

    Sudhe

    Wednesday, June 25, 2008 4:34 AM
  • Hi,
    I am working on a computer different than the one on which WSS is installed.  I setup the databases and SSP under my credentials so I am admin and have db permissions.  But trying to create a new SPSite still throws the same exception.

    Does anyone have any ideas on how to resolve this issue?  

    Thanks!
    Nisa 






    Friday, August 15, 2008 11:59 PM
  • i have My ASP.net Application on Machine A
    the Sharepoint Site on Machine B
    and the Sharepoint Database on Machine C
    ASPX page uploads a user file to Shrepoint site
    if ASP.net and Sharepoint arae on same machine everything works fine
    and if ASP.net and sharepoint are on different machines, the following error is thrown
    The Web application at http://10.0.24.211:8080/TestDocLib/.... 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.
    Any help is more than welcomed
    Friday, January 16, 2009 7:34 AM
  • There seem to be a number of situations that result in the FileNotFoundException discussed in this thread.

    I recently was trying to develop a console app that uses the SharePoint Server OM and was hitting my head against the wall with that error message. I finally stumbled on Corey Roth's blog post: http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/12/01/error-system-io-filenotfoundexception-the-web-application-at-lt-servername-gt-could-not-be-found-console-applications-with-sp2010.aspx

    which suggested that the console app was being built as an x86 app and therefore unable to interact with SharePoint (running as x64). Indeed, this turned out to be my problem.

    Note: this was programming against SP 2010

    Moderator Notes:

    1. Never give SP 2010 answers in the pre-SP 2010 forums

    2.Never propose your own posts as answers. The Propose as Answer function is for people to propose the good answers of other people. It is not for self-proposal.

    • Proposed as answer by Nathaniel Granor Monday, January 25, 2010 11:42 PM
    • Unproposed as answer by Mike Walsh FIN Tuesday, February 15, 2011 3:57 PM
    • Edited by Mike Walsh FIN Tuesday, February 15, 2011 3:59 PM Moderator Notes added
    Monday, January 25, 2010 11:41 PM
  • Works! Mucho Thanks!

    Setting to x64 did this for me!!
    Tuesday, March 2, 2010 11:07 PM
  • For me the error came when i was exporting a subsite, the mistake with me was, i was trying to export from the live site.

    so i went back to central admin-and found the  alternate access mapping for the site.

    and did the export and it was perfect!


    Share Knowledge and spread peace!
    Saturday, May 1, 2010 2:38 PM
  • Thx mate for leading me in the right direction, saved me a lot of research. My problem was that i was calling the SPSite() from a windows service, and that windows services by default is running System.ServiceProcess.ServiceAccount.LocalSystem - our SQL is located on a different server as well as yours:

                this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.User;
                this.serviceProcessInstaller1.Password = this.Context.Parameters["Password"];
                this.serviceProcessInstaller1.Username = this.Context.Parameters["User"];

    ..and wupti now i can call the sharepoint API like normal :)

    Thursday, July 15, 2010 5:05 PM
  • This Issue is more of user permission issue give the following permission

    User Permission SharePoint Site --- Minimum Read Permission

    Sharepoint Server --- Add to WSS_ADMIN_WPG group

    Database --- Sharepoint Content DB (Site collection database) - db_owner permission Sharepoint Config DB (Config DB of sharepoint installation) - - db_owner permission

    Read more in my blog

    http://sharepointinstallation.blogspot.com/2010/12/minimal-permission-required-to-execute.html

    Monday, December 6, 2010 6:03 PM
  • Yes ChrisF, You are so right. I had the same problem got fixed as u suggested . Its not matter of being dumb. To make mistake is so easy. Being in IT does not mean to be technically smart or dumb, they gotta have sense of appreciation. I appreciate the point you tried to help out.
    Tuesday, February 15, 2011 3:39 PM