VS 2010: 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.

We faced following error when trying to contact to site through SharePoint Object Model.

System.IO.FileNotFoundException was unhandled

Message=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.

Source=Microsoft.SharePoint

StackTrace:

at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)

at Microsoft.SharePoint.SPSite..ctor(String requestUrl)

at InsertWebPart.Program.Main(String[] args) in c:\….\Program.cs:line 14

at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)

at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ThreadHelper.ThreadStart()

 

Resolution:

Make following changes in VS 2010 project:

  • Right click on prject -> Properties, Build tab, select x64 from “Platform Target” drop down.
  • Application tab, select “Target farmework” as per your .Net framework. We selected 3.5

Hope this will help.

Advertisements

3 Comments »

  1. Tamer Abdelaziz said

    so many thanks, your post solved my problem.

  2. really thx for ur solution that helped me.

  3. warren elkins said

    Same symptoms but no fix-em

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: