R – Sharepoint SPSite

sharepoint-2007spsite

I am trying to create a spsite of object for sharepoint search but i am getting exception in production as website not found

SPSite site = new SPSite("sitename");
ServerContext scon = ServerContext.GetContext(site);
SearchContext srchcontext = SearchContext.GetContext(scon);
Scopes sc = new Scopes(srchcontext);

It throws exception site not found i have checked the name of site it exixts.

Any Help??

Best Answer

Check that you are building against the correct target. I.e. x86 vs x64. I get this error when I build against x86 and try and run against x64.

Related Topic