Deploying, Testing, and Troubleshooting the Solution

Applies to: Duet Enterprise for Microsoft SharePoint and SAP Server 2.0 | Office 2010 | SharePoint Server 2010

In this article
Building and Deploying a Solution from Visual Studio
Testing Basic Functionality in the Solution
The SharePoint Developer Dashboard
Deploying the Solution to a Production Server

The Duet Sales Order Management solution is now functionally complete. In the previous topic you added logging capabilities to the solution. In this topic, we look at deployment options for the solution and some basic testing and monitoring of the solution.

Building and Deploying a Solution from Visual Studio

In the process of developing the Duet Sales Order Management solution over the course of this walkthrough, you have already been working with SharePoint deployment components such as Features and deployment packages.

During development, you can build and deploy your solution directly from within Visual Studio simply by clicking Deploy Solution from the Build menu. Visual Studio builds the solution, creates a Web solution package (.wsp), and deploys that package to the SharePoint site specified in the Site URL property of your solution. If an earlier version of the solution already exists on the site (that is, if a solution with the same name or SolutionId exists on the site), Visual Studio retracts that earlier solution before adding the updated solution to the server. If the Active Deployment Configuration property of the solution is set to "Default", then after deployment, Visual Studio also activates any Features in the solution on the SharePoint site. If the Active Deployment Configuration property is set to "No Activation", then the solution is built, packaged, and deployed, but no Features are activated after deployment. In that case, you can activate solution Features manually on the target SharePoint site by carrying out the following steps after deployment.

  1. Navigate to the site or site collection (depending on the scope of the Feature) where a given Feature is installed.

  2. Click the Site Actions menu on the Ribbon and click Site Settings.

  3. Under the Site Actions heading, click Manage site features.

  4. Identify the Feature that you want to activate in the list of Features available on the site that and click Activate.

For the Duet Sales Order Management solution, the title and description of the Feature that appears on your target site depends on what has been specified for the Feature in Visual Studio. To modify the title and description of a Feature in Visual Studio, double-click the Feature in Solution Explorer. Figure 1 shows the Feature in the Duet Sales Order Management solution that is scoped to the level of a Web site, SalesOrderSiteFeature, in the Visual Studio Feature Designer.

Figure 1. Duet Sales Order Feature in Visual Studio Feature Designer

Duet Sales Order Feature in Feature Designer

After deployment of the solution, in the Features list on the target SharePoint site, you will see the Feature displayed with the specified title and description, as in Figure 2.

Figure 2. Duet Sales Order Feature on a SharePoint site

Duet Sales Order Feature on a SharePoint site

Note that the Feature in the Duet Sales Order Management solution that is scoped to the level of a site collection, SalesOrderWebPartsFeature, shows up in the list of Features for the site collection and not in the list of Features for individual subsites of that site collection. It is not necessary to manually activate the site-collection level Web Parts Feature for the solution because SharePoint activates such Features automatically.

For more information about modifying Features using the Feature Designer in Visual Studio, see the topics Creating SharePoint Features and How to: Customize a SharePoint Feature in the MSDN Library.

As mentioned in the topic on Debugging the Solution and Adding Logging Capabilities, you can also press F5 in Visual Studio to build, package, and deploy your solution to the target SharePoint site, and Visual Studio will also open the target site and attach the Visual Studio debugger to the appropriate SharePoint process.

Testing Basic Functionality in the Solution

On your development system, run through various usage scenarios. If your development system can access the endpoints of the Web Services on which the sales order external content types are based, and you are using sample data (rather than critical production data), try deleting sales order headers or adding sales order items related to a given header and so on. The Show Related Sales Order Items command on the list item menu for individual sales order headers should, for example, bring up the list of sales order items filtered based on the SalesOrderSclKey value of a given sales order header, as in Figure 3 (which shows sample data used for testing purposes only).

Figure 3. Related sales order items functionality

Related sales order items functionality

The SharePoint Developer Dashboard

SharePoint 2010 includes another facility useful for testing and troubleshooting solutions and displaying process information called the Developer Dashboard. In a production environment, the Developer Dashboard would likely not be enabled, but for testing purposes in a development environment, you can enable the Dashboard to display diagnostic information for tracking down errors and performance problems in your solution. In order to enable the Developer Dashboard, you must use stsadm.exe, a Windows PowerShell command, or you can enable the Dashboard using the SharePoint object model. (For information about enabling the Developer Dashboard in a SharePoint farm, see the topic Using the Developer Dashboard in the MSDN Library.)

When the Developer Dashboard is enabled, a panel that displays diagnostic information and performance indicators appears on all pages on a site that use the SharePoint Foundation 2010 master page or any page that uses a custom master page on which the Dashboard control is included. Figure 4 shows the operations displayed in the Developer Dashboard for a single execution of the Show Related Sales Order Items command on the list item menu for a given sales order header in the Duet Sales Order Management solution. The command ultimately makes an HTTP GET request against the Sales Order Items List on the SharePoint site where the solution is deployed, filtered based on a specific SalesOrderSclKey value of the sales order header on which the command was executed. The Developer Dashboard shows all of the related requests and operations to support the command, along with performance counters.

Figure 4. Developer Dashboard information

Developer Dashboard information

One of the conveniences of the Developer Dashboard is that it displays Correlation IDs for operations on the server. Correlation IDs are globally unique identifiers (GUIDs) generated by SharePoint for every request received by the server. Figure 5 shows the Correlation ID displayed in the Developer Dashboard for the Show Related Sales Order Items command that was executed against the Sales Order Items List.

Figure 5. Correlation ID

Correlation ID

The Correlation ID allows you to track an operation in your solution in all the contexts in which the operation executes because the same value is maintained across all SharePoint Servers in a farm (if the operation involves multiple servers) and even in an SAP backend system on which Duet Enterprise has been installed. If you encounter an error or if you get unexpected results from an operation, you can identify any activity related to the operation by searching or filtering the ULS logs for the associated Correlation ID. For a given Correlation ID there will often be hundreds of entries in the trace logs, allowing you to track an operation to a great level of detail.

In addition to displaying a list of actions executed to support a given operation and the Correlation ID, the Developer Dashboard displays any asserts or critical events encountered in the course of an operation, as well as database queries, Web Service calls, and the number of SPRequest allocations involved in an operation. SPRequest objects are allocated whenever certain SharePoint objects like SPSite or SPWeb are used. If a given operation requires a large number of SPRequest allocations, it might be worthwhile to investigate whether unnecessary SharePoint objects are being created by your code or SharePoint objects are not disposed properly. (For more information about using SharePoint objects, see the topic in the MSDN Library on best practices for disposing of objects in SharePoint.) The number of SPRequest allocations is also tracked in the SharePoint ULS logs, but the Developer Dashboard is a convenient tool for assessing the overall performance of your solution and it can help you determine whether investigating a problem more thoroughly by analyzing the log files is needed.

For more information about monitoring a solution in Duet Enterprise and tracking down problems, see the topic Overview of monitoring and troubleshooting (Duet Enterprise) in the TechNet Library.

Deploying the Solution to a Production Server

Eventually, after sufficient testing in a development environment, you may want to deploy the Duet Sales Order Management solution to a production SharePoint farm.

When you deploy a solution to a SharePoint site from within Visual Studio 2010, a Web solution package file (*.wsp) is automatically created by Visual Studio. This solution package file is simply a cabinet file that contains any output assemblies from the solution, Web Parts, Feature manifests, scripts, schemas, control description files, and any other artifacts that constitute a SharePoint solution. You can also create the package file specifically (that is, not as a step in the deployment process) by clicking Package on the Build menu in Visual Studio. The file is created and, depending on your solution configuration, the file is saved to the appropriate directory, either Debug or Release, within the binary directory (called "bin") for your solution.

Then, you or a SharePoint administrator can add the solution package file to a SharePoint Server. The Duet Sales Order Management solution is a farm solution, so it can't be added to the SharePoint farm solution database through Central Administration in SharePoint. You or an administrator must use stsadm.exe or the Add-SPSolution PowerShell cmdlet to add a farm solution to a SharePoint farm, and then the solution can be deployed using Central Administration (or stsadm.exe or Windows PowerShell). To add a solution to a SharePoint farm using stsadm.exe or Windows PowerShell, you must be a SharePoint Farm Administrator and your user account must be in the local Administrators group on the computer on which you are running the commands.

To add the Duet Sales Order Management solution to the solution database of a SharePoint farm and to deploy the solution using Windows PowerShell, you or a SharePoint administrator can perform the following steps.

  1. Copy the Duet Sales Order Management solution package file (DuetSalesOrderSolution.wsp) to a SharePoint Server (or to a location accessible from the server).

  2. From the Start menu, click All Programs, then click Microsoft SharePoint 2010 Products, and then click SharePoint 2010 Management Shell.

  3. At the Windows PowerShell command prompt, execute the following cmdlet, specifying the appropriate path to the Duet Sales Order Management solution package file:

    Add-SPSolution –LiteralPath [Specify path to your file here.]\DuetSalesOrderSolution.wsp
    
  4. Confirm that the SharePoint 2010 Administration service is running. If not, start the service in the Services Management Console. (Click Start, then click Run, type "services.msc" and click OK to start the Services Management Console.)

  5. Then, to deploy the solution, execute the following cmdlet, specifying the URL for a root Web Application on a SharePoint Server with Duet Enterprise installed:

    Install-SPSolution –Identity DuetSalesOrderSolution.wsp –WebApplication [Specify URL of a target Web Application here.] -GacDeployment
    

    Note that you must specify the URL of a SharePoint Web Application for this command, which may not necessarily be the same as the target site specified in the Site URL property of the solution during development.

  6. Navigate to a site within the site collection associated with the Web Application specified in Step 4 and activate the Duet Sales Order Site Feature on the site. (See the steps for activating a Feature in the section of this topic on Building and Deploying a Solution from Visual Studio.)

For additional information about using Windows PowerShell with SharePoint, see Windows PowerShell for SharePoint Server 2010 in the TechNet Library. For more detailed information about configuring and deploying solution packages in SharePoint, see Deploy solution packages (SharePoint Foundation 2010) in the TechNet Library.

In addition to installing the solution on a SharePoint Server with Duet Enterprise, you will also need to import the necessary BDC models to the Metadata Store of the server. See the topic Data Models for the Duet Sales Order Management Solution in this walkthrough for information about the models required by the Duet Sales Order Management solution.

See Also

Other Resources

Packaging and Deploying SharePoint Solutions

Installation and Deployment of a Farm Solution in SharePoint 2010

Troubleshooting SharePoint Packaging and Deployment