Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Sharepoint Access Deployment , +
Hi,
 
I have developed solution also I created a WSP file. By using power shell i deployed the Wsp in the sharepoint. Now i trying to programatically deploy another Wsp using C# and I got an Erroe "Access Denied".
 
This is My Code to add and deploy the solution.
 
SPFarm.Local.Solutions.Add((Server.MapPath("~/_layouts") + "/DemoWSP10.wsp"));
                SPSolution customSolution =  SPFarm.Local.Solutions["DemoWSP10.wsp"];
                
                customSolution.Deploy(DateTime.Now, false, true);
 
I debug the code,I find that the exception occured in the first line.
 

Thanks,
Velkumar.
Posted 29-Dec-11 19:34pm
Edited 29-Dec-11 19:36pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You are trying to run code farm level code. Are you using an account that has farm level permissions?
 
You may need to look at this SPSecurity.RunWithElevatedPrivileges[^]
 
Solutions.Add returns an SPSolution, so there is no need for
SPSolution customSolution =  SPFarm.Local.Solutions["DemoWSP10.wsp"];

 
You should also be using SPUtility.GetGenericSetupPath[^] rather than Server.MapPath
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
I want to deploy it globally. Our default port is 80 and 22222 for Central Administration. Where should I need to change the security settings. What is the procedure for globally deploy the solution.
 
Also I am using the farm level account as Administrator, which has full control permission.
  Permalink  
v2
Comments
Mark Nischalke at 31-Dec-11 0:06am
   
First, you add a question or comment, not a new solution
 
Unless it is a farm solution meant to used in central admin you should not deploy it there. A farm solution is deployed globally, thats the meaning of farm solution. I believe you need to do some research on SharePoint solutions and deployment before attempting to work with them or sharepoint.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,149
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 31 Dec 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100