0

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)
                Console.WriteLine(list.Title);
        }
    }

4 Answers 4

1

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,

Alex

0

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.

0

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

-1

http://spserver2010.blogspot.com/2010/09/visual-studio-2010-beta-console.html

1
  • 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
    Commented 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.