sharepoint 2010 - Not able to access SPSite object, throwing exception -


   try         {          string targetsite = "https://abc.xyz.com/";               using (spsite scsite = new spsite(targetsite))              {                lblstatus.text = "sharepoint connection - success";                                  }          }         catch (exception ex)         {            lblstatus.text = "sharepoint connection - success";         } 

trying run above code in visual studio 2012 in console application running fine if try run same in web application project throwing below exception. trying code on server sharepoint 2010 installed , using .net 3.5 clue why happening!!

system.io.filenotfoundexception: "the web application @ http://abc.xyz.com not found. verify have typed url correctly. if url should serving existing content, system administrator may need add new request url mapping intended application."

here common reasons error can occur:

the code executed on different machine - sharepoint object model (except client api) requires run on sharepoint server itself. not possible run application on server not within same sharepoint farm code trying access.

insufficient rights on site collection - code executed in context of account not have read permission on site collection incorrect url being used - verify site works correct in browser , double check server correct registered in aam settings

incorrect bitness - sharepoint object model needs executed same bitness operating system. means cannot use sharepoint object model in 32-bit application if operating system , sharepoint installed 64-bit version. ensure compile project using correct bitness (64-bit on 64-bit machine vs. 32-bit on 32-bit machine)

incorrect .net framework version - ensure project configured use .net 3.5 sharepoint 2010 , below , .net 4.0 sharepoint 2013

source

also microsoft sharepoint not supported in 32-bit process. please verify running in 64-bit executable. enter image description here


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -