Tuesday 24 August 2010

Error: System.IO.FileNotFoundException in client application

Recently, I was trying to create a console application and using Sharepoint object Model. My console application and sharepoint web application was on the same machine.
While creating the SPSite object I was getting following error.

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

The error was very much misleading, after struggling a bit I found that by default client application's platform target was set to X86 i.e 32 bit so it was not able to access the webapplication which is targeted as 64 bit. So to overcome this issue I had to change my platform target to "AnyCPU" or X64.

Ironically, it was working fine when I was using "Sharepoint Client Object Model"

No comments:

Query List/Document Library in Specific Folder

To query SharePoint List or Document Library in specific Folder “ FolderServerRelativeUrl ” as part of the CAML Query Code Snippet ...