Error Details:

The Web application at http://dev001aaamaaind:333/ 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.

   string urlSite = "http://dev001aaamaaind:333/";
     using (SPSite sc = new SPSite(urlSite))//Getting Error in the line
        SPWeb site = sc.RootWeb;
        foreach (SPList list in site.Lists)
            if (!list.Hidden)

4 Answers 4


Ok a couple of things to check:

  1. Does the account that you are executing the console application with have permissions to that SharePoint site? - probably best to make the account a Site Collection admin for dev purposes.

  2. Is this a 64-bit or 32-bit environment? If it is 64-bit make sure you target the build of the console app to x64.

Hope this helps,



The reason is SharePoint 2010 is a 64 bit application and by default any visual studio solutions complies and excuted in x86 mode. Thus thie error will be encountered.

So you need to compile and run your console application in Any CPU or x64 mode.. preferably go for Any CPU due to some performance reasons.


The account that runs the Console Application may not have the required level of database access.



  • 1
    -1: This isn't a very helpful answer. Linking to another site doesn't help the community that are looking for an answer here.
    – Alex Angas
    Nov 14, 2010 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.