Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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);
        }
    }
share|improve this question
add comment

4 Answers 4

up vote 1 down vote accepted

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

share|improve this answer
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

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

share|improve this answer
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 '10 at 22:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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