Active 4 years, 5 months ago. Viewed 3k times. Improve this question. Are you running the command from the CA? Are the solution scoped for a single web application? Ran the command from both the CA and from a different server on the farm - either way, the CA server wasn't getting the deployment timer job. Also, all features are Web Application scoped or lower — acarrell.
Add a comment. Active Oldest Votes. Improve this answer. We faced this issue when we were upgrading our Sharepoint to Sharepoint environment Cause: Microsoft Sharepoint Foundation Web Application Stuck on Starting in Application Server Solution: Stopped and Started Microsoft Sharepoint Foundation Web Application which resolved the issue: stsadm -o provisionservice -action stop -servicetype spwebservice stsadm -o provisionservice -action start -servicetype spwebservice.
At this point, you have finished your initial work on the MasterPageGallery module. Now you should turn your attention to the Feature that will be used to deploy this module. Notice that when you added the module to the Branding project, the SharePoint development tools in Visual Studio automatically create a new Feature named Feature1. Locate this Feature in Solution Explorer , right-click it and rename it to Main.
After you rename the Feature, double-click the Feature node so that you can see the Feature in the Feature Designer. Change the Title of the Feature to something more appropriate, such as Branding Sample Feature, as shown in Figure 5. It is also important to change the Scope of the Feature from Web to Site so that it activates at the level of the site collection and not the level of the site.
After you create a custom master page, the next step is to add a custom CSS file that contains the CSS rules for your branding solution.
As discussed earlier, it is a best practice in SharePoint to deploy custom CSS files in the Style Library because it works with both sandboxed solutions and farm solutions. This technique works in farms that are running SharePoint Server and also farms that are running only SharePoint Foundation.
It must be noted that many other common approaches to branding SharePoint sites do not provide this level of flexibility. The new Module project item initially contains an element manifest named Elements. Right-click Sample. Next, right-click the Style Library module node, and on the Project menu, select Add and then New Folder to create a new child folder in the Style Library module. Name the folder Branding After you create this folder, you can move the styles.
After you move the styles. Add the following padding-top attribute so that you have some visual feedback as to when you are correctly linking to this CSS file. The next step is to add some image files to the project.
The best approach is to add your custom image files inside the Style Library so that they are easier to reference from within your custom CSS file. In the Branding folder, create an Images folder, and add some image files to this folder. This example uses two images: One image file, named Background.
After you add the image files to the Images folder, you can easily reference them from the CSS rules inside styles. To demonstrate this, add the following updates to the styles. At this point, you have completed your initial work with the Style Library. Unlike with the MasterPageGallery module that you created earlier, you do not have to modify the Elements. The SharePoint development tools in Visual Studio can add all the appropriate File elements for you behind the scenes.
Furthermore, you can continue to add more image files into the Images folder, and they are automatically deployed in the correct location in the Style Library for you. Now that you have added two Module project items to deploy a custom master page and a custom CSS file, it is time to write some code to put them to use. You do this by adding a Feature receiver to the Feature named Main. Begin your coding by cleaning up and restructuring the source file for your Feature receiver class to look like the following example.
Now let's step through what you have to do when the main Feature is activated. First, you must determine the path to Branding Note that the path to the master page must be calculated relative to the root of the hosting web application. Next, you must enumerate all the sites in the current site collection and update several properties of each site to use the custom master page and the custom CSS file.
The MasterUrl property of the SPWeb object is the property that you use to redirect site pages and application pages to link to a custom master page, such as Branding The previous code example calculates the path to Branding Updating the CustomMasterUrl property is important only in publishing sites that contain publishing pages inside the Pages document library.
The CustomMasterUrl property is used to reassign the master page for publishing pages. Assigning a new value to the CustomMasterUrl property in a SharePoint Foundation site has no effect nor does it cause any problems.
The linking behavior that is associated with the AlternateCssUrl property is implemented by the SharePoint CssLink control, which is defined in the head section in all the standard SharePoint master pages.
Although the branding solution in this article relies on the approach of linking to a custom CSS file using the AlternateCssUrl property, be aware that some branding solutions take an alternative approach of linking to a custom CSS file by using the CSSRegistration control. For example, you can add the following CssRegistration element to the head section of a custom master page to link to a CSS file inside the Style Library.
A second advantage is that you can use the CssRegistration control in individual pages for scenarios where you have a CSS file that is used by some, but not all, pages within a site. If there is a chance that your branding solution will be used in farms that are running only SharePoint Foundation, you should prefer the technique of linking to a custom CSS file using the AlternateCssUrl property over using the CssRegistration control.
The SiteLogoUrl property is used in this example because it provides a quick and effective way of replacing the site image in the upper-left side of the page. Note that the behavior that is associated with the SiteLogoUrl property is implemented by the SharePoint SiteLogoImage control, which is defined in the Title Row section of standard SharePoint master pages, such as v4.
The example in this article assigns a value of 4 to the UIVersion property to ensure that pages are linked to corev4. So far, you have learned how and why the Branding solution configures important SPWeb properties on every site in the current site collection during Feature activation.
This also means that sandboxed solutions can only access information in the site collection to which it is deployed. To deploy a solution into the Solution Gallery, you go to Site Settings of the root web of the site collection and choose the gallery called Solutions. When the solution package is uploaded, it appears in the Solution Gallery; you can then select the solution and click Activate in the Ribbon to activate it or Deactivate to deactivate the solution , as shown in figure 7.
To be able to install sandboxed solutions, the user has to be a site collection owner, so not everyone is allowed to install sandboxed solutions. SharePoint monitors all solutions running in the sandbox and logs counters such as CPU usage, thrown exceptions, and database queries.
Each resource use is logged and assigned points, as shown in figure 7. The point quota is per day, so after 24 hours the solutions will be available once again. The sandbox is controlled by the Sandboxed Code Service, described earlier.
Use the resulting configuration page to block user code solutions and specify load balancing for the Sandboxed Code Service. The resource quotas for the sandboxed solutions are specified per site collection. Use the resulting page to set the maximum daily resource usage limit and the level of resource usage when a warning email should be sent to the site collection administrator. The quota templates used when creating site collections in SharePoint also contain the default values for the user code resource usage and the warning level.
PowerShell can be used to configure the Sandboxed Code Service. This command lists all current service instances in the farm.
This command will stop the service with the specified id:. The SharePoint PowerShell snap-in contains cmdlets for working with user code solutions.
When deploying a user code solution on several site collections, you should use Power-Shell scripting. The command takes the URL to the site collection as a parameter:.
This command only lists the sandboxed solutions within one site collection, but using command piping in PowerShell, you can combine a few SharePoint cmdlets to list all installed user code solutions in the farm:. Finally, all user code solutions for each site collection are printed.
Just as when installing farm solutions, the user code solutions have separate cmdlets. Before removing any user code solutions, you need to deactivate them.
Solutions built for the sandbox are limited due to the policy restrictions. You have three options if you need access to information available outside the sandbox from your user code solutions:.
The first option is in many cases not an option at all such as in hosted scenarios. A full-trust proxy is an assembly that runs under full trust and is registered as a proxy with the Sandboxed Code Service. Sandboxed solutions can interact with the installed full-trust proxies and through them access external data.
By making good decisions on what to install as full-trust proxies, you can minimize the amount of work spent on code reviews and server installation planning.
First, create a new solution in Visual Studio based on the Empty SharePoint project template and choose to deploy it as a farm solution. A full-trust proxy contains proxy operations that are called by the sandboxed solutions. Create the proxy operations by adding a new class to the project that inherits from the SPProxyOperation class, available in the Microsoft. UserCode namespace. To pass arguments to the proxy operations, you need to create another class that inherits from the SPProxyOperationArgs class.
The proxy operation arguments class must be marked as serializable, and it inherits from the SPProxyOperationArgs class. A constructor is added that takes a string as an argument; that string is assigned to a public property. The proxy operation will take an SPProxyOperationArgs object as an argument, which will be cast to the custom proxy operation argument.
This method is called by the sandboxed application using the proxy operation arguments. After casting the generic operation arguments into the custom arguments, the RSS is loaded using the XElement class, available in the System.
Linq namespace; then the XML is returned as a string. That completes our custom full-trust proxy; all you have to do now is register it with SharePoint. The best way is to add a new Feature to the project and set its scope to Farm level.
Implement an event receiver for this Feature that will register the proxy when activated and unregister it when deactivated. This approach lets you easily manage the proxy from Central Administration. However, administrators can turn the proxy on or off as they like. In the event receiver, you have to implement the activation and deactivation methods, as shown in listing 7.
The FeatureActivated method gets the Type of the proxy operation class and retrieves the user code service. Using the service, it adds a new proxy operation type , which takes the full name of the assembly and class as arguments. Finally, the method updates the user code service to reflect the new proxy operation type. The FeatureDeactivating method is similar but instead of adding the proxy it removes it. Once the Feature is activated, any user can create a sandboxed solution and access this full-trust proxy.
The code will look like listing 7. To call the proxy, the SPUtility. ExecuteRegisteredProxyOperation method is called. This method takes the full assembly name and the class name of the proxy operation as arguments. These names must be exactly the same as the ones the proxy operation is registered with.
The final argument is an object of the custom proxy operation argument. You deploy the sandboxed Web Part just as you would any other sandboxed solution. Once you add it to a page, it will show the specified feed. Using full-trust proxies allows you to leverage fully trusted code to sandboxed solutions developers. Deploying partial trust solutions requires that you manually configure the security policy for your assembly using custom Code Access Security CAS policies. You should start a project by creating a farm solution in the SharePoint Configuration wizard.
To change the assembly deployment target, select the project in the Solution Explorer and then press F4 to open the Properties window. This window contains a property called Assembly Deployment Target, as shown in figure 7.
If you created a solution targeted for sandboxed deployment, you need to change the Sandboxed Solution property to False to enable the Assembly Deployment Target property. The benefits of running Web Parts under partial trust are that doing so is more secure than running under full trust. To get access to more functionality in a sandbox, you need to build full-trust proxies; that means you must install two different solutions.
The disadvantage of partial trust solutions is that they require manual handling of CAS policies. The ASP. The Visual Studio SharePoint Power Tools, available for download through the Extension Manager, allow you to create a Visual Web Part that works without loading the user control from the file system. Changing the deployment target for the assembly will change the XML for the Package project item.
The Assembly node has an attribute called DeploymentTarget that reflects the value of the project property. This attribute allows partially trusted assemblies to call your assembly. Then press F5 to build, package, and deploy the solution. Once the deployment is done, add the Web Part to a page and see that it works.
The solution you just created now runs under the same security level as the web application. Farm solutions run under full trust, which means that any deployed code can do whatever it wants with your servers.
The security level of the web application is configured by the trust element in the web. By default, web. This is a default minimal level of security defined by SharePoint. If you need to manually change the settings, make a copy of them and edit the copy. This essentially makes the CAS policies useless. The whole purpose of using such policies is that the administrator who owns the SharePoint farm sets the security level of the solution.
Change the Text property so that it looks like this:. This Label control will now output the name of the site, which is retrieved using the SPContext object. To allow the solution to execute this code, you must add a custom CAS policy to the solution. A custom CAS policy is defined in the solution manifest for the package. During installation, the trust level in web.
This custom policy file contains the default policy file and all merged custom CAS policies. To add a custom policy to the solution, use the Package editor.
In the Package designer, select the Manifest tab and then click Edit Options to bring up the editor. You can use the Package editor to add additional XML to the solution manifest, and the custom XML will be merged with the automatically generated XML and form the final solution manifest. Everything was proceeding fantastically until I needed to deploy my farm solution containing many web parts from my development server to another SharePoint server for demonstration purposes.
Visual Studio provides outstanding functionality for creating Web Parts for SharePoint, and can deploy them locally provided that SharePoint is installed locally , but it cannot deploy them to a different remote server.
Name required Name Is Required. Comment Is Required. Notify me of followup comments via e-mail.
0コメント