Sharepoint Object Model C# Error The Web Application at could not be found. Verify that you have typed the URL correctly

By peter.stilgoe









When running some C# code containing a reference to SPSite ie

        string siteUrl = "http://devapp01/";
        using (SPSite spSite = new SPSite(siteUrl))

I was getting the following error:

The Web Application at 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.

Looking at various forums people have spent along time troubleshooting this problem, in my case it was easily fixed by:

Go to Project Properties -> Build -> Target Platform -> Make it Any CPU (default is x86)

Share

, , , ,

About... peter.stilgoe

peter.stilgoeThis author published 497 posts in this site.
Sharepoint, InfoPath, K2, Nintex, Business Process Mapping, Business Intelligence, Automation, ECM, Document Management, Document Imaging, Internet Marketing & Online Business Consultant Email / MSN: pstilgoe@hotmail.com LinkedIn: Pete Stilgoe - Sharepoint Consultant









Share

FacebookTwitterEmailWindows LiveTechnoratiDeliciousDiggStumbleponMyspaceLikedin

6 Comments

  • At 2011.03.18 07:55, Venkatesh said:

    That saved my day.. Thank you very much

    [Reply]

    • At 2011.03.30 06:38, Michael Hirst said:

      Mine too!

      [Reply]

      • At 2011.11.17 12:41, Samuel said:

        I get the following error both on the when developing on the server and locally “The Web application at http://URL 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”

        [Reply]

        • At 2012.01.18 09:00, Vijay said:

          This worked. Thanks

          [Reply]

          • At 2012.02.28 12:58, Ajay said:

            it is working, thank you

            [Reply]

            • At 2012.03.28 06:59, kishore said:

              Thanks a lot its working…………..:-)

              [Reply]

              (Required)
              (Required, will not be published)