How to: Run a Load Test Containing Web Performance Tests that Collects ASP.NET Profiler Data
This topic applies to:
Visual Studio Ultimate
Visual Studio Premium
Visual Studio Professional
Visual Studio Express
The ASP.NET Profiler data and diagnostic adapter can be configured in a test settings that will be used with a load test that contains a web performance test that is used on an ASP.NET web application. To profile the website, you must also install a test agent on the Internet Information Server (IIS) machine. This agent will not generate load, but will be an agent for collection only.
To collect ASP.NET profiling data on your ASP.NET web application, you must complete or verify the following:
Create or Select an ASP.NET Web Application to Profile
You must select an existing ASP.NET web application on which you want to collect ASP.NET profiling data or create one. For more information about how to open an existing ASP.NET web application, see How to: Edit an Existing Web Performance Test Using the Web Performance Test Editor. For more information about how to create an ASP.NET web application that you can use to test this concept, see Walkthrough: Creating a Simple Web Application.
For more information about ASP.NET web development, see ASP.NET Portal.
Modify Test Settings to Include ASP.NET Profiler Data and Diagnostic Adapter
Test settings can be configured for load tests to enable distribution of the load test across multiple machines by using test agents and test controllers. For more information, see How to: Create a Test Setting for a Distributed Load Test. The test settings can also be configured to use diagnostic data adapters, which specify various types of data to collect or how to affect the test machines when you run your load tests from Visual Studio 2010 Ultimate. Additionally, diagnostic data adapters can be used to simulate potential bottlenecks on the test machine or reduce the available system memory. You can use the ASP.NET profiler diagnostic data adapter to collect ASP.NET profiler information. This diagnostic data adapter collects performance data for ASP.NET applications.
This diagnostic data adapter cannot be used for tests that are run by using Microsoft Test Manager. You may use the ASP.NET Profiler diagnostic adapter only with load tests that use web sites, which requires Visual Studio 2010 Ultimate.
The ASP.NET profiler diagnostic data adapter lets you collect ASP.NET profiler data from the application tier while you run a load test. You should not run the profiler for long load tests (for example, load tests that run longer than one hour) because the profiler file can become large, perhaps hundreds of megabytes. Instead, run shorter load tests with the ASP.NET profiler. This will still give you the benefit of deep diagnosis of performance problems.
The ASP.NET profiler diagnostic data adapter profiles the IIS process. Therefore, it will not work against a development web server. To profile the web site in your load test, you have to install a test agent on the machine on which the IIS is running. The test agent will not generate load, but will be a collection-only agent. For more information, see Installing and Configuring Visual Studio Agents and Test and Build Controllers.
From Microsoft Visual Studio Ultimate, open the test settings that you will use with your load test that contains the Web performance test for your ASP.NET web application. Select the Data and Diagnostics page. For more information, see Create Test Settings to Run Automated Tests from Visual Studio.
Select the role to use to collect the ASP.NET profiler data.
Select ASP.NET Profiler to enable collection of ASP.NET profiling data, and then click Configure.
The dialog box to configure ASP.NET profiling data collection is displayed.
In Profiler Sampling interval, type a value that indicates how many non-halted CPU clock cycles to wait between taking ASP.NET profiling samples.
To enable tier interaction profiling, select Enable Tier Interaction Profiling.
Tier interaction profiling counts the number of requests that are sent to the web server for each artifact (for example, MyPage.aspx or CompanyLogo.gif) and the time that was required to service each request. Additionally, tier interaction profiling collects the ADO.NET connections that were used as a part of the page request, and how many queries and stored procedure calls were executed as a part of servicing that request.
Two different sets of timing information are collected:
The timing information (Min, Max, Average and Total) for servicing each web request.
The timing information (Min, Max, Average and Total) of executing each query.
For more information, see How to: Configure ASP.NET Profiler for Load Tests Using Test Settings.
Install a Test Agent on the Internet Information Server
On the IIS Server machine, load the "Microsoft Visual Studio Agents" CD and then start setup.exe, which is located in the root folder.
To install a test agent, you must be a member of the Administrators security group on the computer.
The user whom you add to start the service or process for the test agent must be a member of the TeamTestAgentService group on the computer for the test controller for this agent.
You can optionally install the test agent on a third machine. A test controller can control several agents on different machines.
The Visual Studio Agents 2010 page appears.
Click Install Visual Studio Test Agent 2010.
The Microsoft Visual Studio Test Agent 2010 Installation page appears.
The Start page is displayed.
Review the License Terms, select I have read and accept the license terms, if appropriate, and then click Next.
The Options page is displayed.
(Optional) Click Browse to select a different installation folder.
Click Install to start the installation.
The Installing Components page is displayed. The test agent installation requires performance tools to be installed to collect performance data when tests are run. When the installation is finished, the Finish Page is displayed.
To configure the test agent that you have installed, select Configure test agent now. Then click Configure to start the Test Agent Configuration tool.
The Configure Test Agent dialog box is displayed.
Click Run Options.
Under Run the test agent as, select Service.
Enter the details about the user when the test agent starts as a service.
Type the name in User name.
Type the password in Password.
The user account must be a member of the administrator’s security group in order to use the ASP.NET Profiler data and diagnostic adapter.
Null passwords are not supported for user accounts.
To register this agent with the test controller that you installed, select Register with test controller. In Register the test agent with the following test controller, type the name of the machine on which you installed the test controller and optionally follow it with a colon (:) and a custom port number to use in your network environment. For example, type Controller1:<port number>.
The default port number is 6901 and does not have to be specified.
To apply your changes, click Apply Settings.
A Configuration summary dialog box is displayed. It shows the status of each step that is required to configure your test agent.
The last step in the installation process resets the network adapter. This may cause brief network outage. This is expected behavior.
To close the Configuration summary dialog box, click Close. Then click Close to close the Test Agent Configuration Tool.
For more information, see Walkthrough: Using a Test Controller and Test Agents in a Load Test, Installing and Configuring Visual Studio Agents and Test and Build Controllers, Configuring Test Controllers and Test Agents for Load Testing, and How to: Specify Test Agents to Use in Load Test Scenarios.
Verify that the IIS Machine Is Using the Proper .NET Framework Version in the Application Pool
In order to deploy an ASP.NET 4 web application, ASP.NET 4 must be registered with IIS on the destination server. In addition, the application pool of the IIS website to which you are deploying must be assigned to the .NET Framework 4. If either of these conditions is not true, you might see one of the following errors when you attempt to deploy:
The default .NET 4.0 application pool does not exist or the application could not be added. Please verify that ASP.NET 4.0 is installed on this machine.
The application pool that you are trying to use has the 'managedRuntimeVersion' property set to 'v2.0'. This application requires 'v4.0'.
ASP.NET 4 is installed when you install Visual Studio. However, the installation process does not automatically register ASP.NET 4 with IIS, and existing IIS websites are not automatically assigned to .ASP.NET 4 application pools. To fix this, register ASP.NET with IIS and set the application pool of the destination IIS website to the .NET Framework version that is required by the package. For information about how to register IIS, see ASP.NET IIS Registration Tool (Aspnet_regiis.exe).
Deploy your ASP.NET Web Application on the IIS Machine
Before you can publish the web application, you must create a publish profile that specifies how to publish. You can create multiple profiles that have different settings. Before you click the Publish button, you can select the profile that has the settings that you want to use. The publish profile settings apply to the active build configuration (for example, Debug or Release). The following procedure explains how to create a profile.
You should not use a production IIS machine for testing purposes.
In the Build menu, click Publish projectname.
The Publish Web dialog box is displayed with Web Deploy as the default value for the Publish method drop-down list, as shown in the following illustration.
In the Publish profile box, enter a name for the new profile.
In the Publish method drop-down list, select Web Deploy, FTP, File System, or FPSE. (If you select FTP, you can also use FTPS.)
If you use the Web Deploy option, the IIS Server must have the Web Deployment Tool installed prior to deployment of your ASP.NET web application. You can download the Web Deployment Tool here: Web Deployment Tool.
The lower half of the Publish Web dialog box changes to show fields that are appropriate for the selected publish method. The following illustration shows the dialog box when FTP is selected.
In the Target Location box, enter a value that corresponds to the publish method that you selected:
For FTP, enter the URL of the destination FTP site (for example, ftp://contoso.com).
For File System, enter the destination folder address (for example, \\servername\folder).
For FPSE, enter the URL of the destination website (for example, http://contoso.com).
If you selected the FTP publish method, perform the following steps:
If you do not want passive mode, clear the Passive Mode check box. You typically require passive mode when the client computer is behind a firewall. For more information, see FTP-Deployed Web Site Projects.
If login is not required, select the Anonymous Login check box. Otherwise, enter credentials in the User name and Password boxes.
If you want the password so that you do not have to enter it every time you publish, select the Save password check box.
The password is saved in encrypted form in an .xml file in your project folder.
Click the Save button to save the profile.
One-click publish is designed to make iterative publishing easy. After you have configured settings and profiles, you can click a button. Visual Studio then deploys your project files to the destination server.
In the Publish Web dialog box, or in the Web One-Click Publish toolbar, click the Publish button.
If you do not see the Web One-Click Publish toolbar, right-click the main menu and select Web One-Click Publish.
The first time you click the Publish button, Visual Studio copies all files that you specified in the Package/Publish Web tab. If you click the Publish button again, only changes are deployed. For example, suppose that your site has 100 web pages and you add one web page. When you click Publish again, only the new web page is copied to the destination server.
For more information about how to deploy your ASP.NET web application, see ASP.NET Web Application Project Deployment Overview, ASP.NET Deployment Content Map and How to: Deploy a Web Application Project Using One-Click Publish Without Web Deploy.
Create a Web Performance Test That Will Test the Site of Your ASP.NET Web Application That You Want to Profile
When your ASP.NET web application has been successfully deployed on the IIS Server, you can create a web performance test for it. Start by opening a test project. For more information about how to create a test project, see How to: Create and Configure Test Projects for Automated Tests.
On the Test menu, click New Test.
The Add New Test dialog box is displayed.
Select Web Performance Test.
In the Test Name box, type an appropriate name. Do not change the .webtest extension. When you are finished, click OK.
The Web Performance Test Recorder opens inside a new instance of Internet Explorer.
Go to the website on the Internet Information Server that contains your ASP.NET web application that you want to test.
(Optional) Click more links in your ASP.NET web application to record additional pages.
Visual Studio displays the recorded web performance test in the Web Performance Test Editor as it is being recorded. After you stop the recording, you can edit the test.
Click Stop to stop recording and close Internet Explorer.
On the File menu, click Save to save the newly recorded web performance test.
For more information, see How to: Create a New Web Performance Test Using the Web Performance Test Recorder, Creating and Editing Web Performance Tests, and Editing the Test Mix to Specify Which Web Performance, Unit and Coded UI Tests to Include in a Load Test Scenario.
Create a Load Test That Uses Your Web Performance Test in Its Test Mix
Open a test project.
In Solution Explorer, right-click the test project node, click Add, and then click Load Test.
Your load test will be created with a default name of LoadTestn, where n is the next available number.
In Solution Explorer, right-click the test project node, click Add, and then click New Test. In the Add New Test dialog box, select the Load Test template, type a name for the test, and then click OK.
The New Load Test Wizard starts with the Welcome page displayed.
Click Test Mix.
On the Test Mix page of the New Load Test Wizard, click Add to add your Web performance test to the load test scenario. In the Add Tests dialog box, under Available tests, select your Web performance test for your ASP.NET web application, click the right arrow to move it under Selected tests, and then click OK.
Select your preferred test mix by adjusting the sliders in the Distribution column, or by typing the percentage values directly into the % column. For more information, see About the Mix Control for Load Tests.
After you launch the New Load Test Wizard, you will use the different pages to specify the settings for your load test. Procedural information can be found in the following topics:
Run the Load Test and View ASP.NET Profiling Data
Start your load test as you usually. From the test project, open a load test.
With a load test open in the Load Test Editor, click the Run button on the toolbar. Your load test starts to run.
- or -
Select the test in the Test View window. Right-click it and select Run Selection. Your load test starts to run.
- or -
Select a test in the Test List Editor window by selecting the check box in the row of the test, and then click the Run Checked Tests button. Your load test starts to run.
For more information, see Running Load Tests.
After a load test has completed, the Load Test Analyzer appears as a new tabbed document that has the load test summary displayed.
For more information, see Load Test Analyzer Overview.
Click the View Profiler Performance Report button on the Load Test Analyzer toolbar to generate and display the ASP.NET Profiler report.
The following illustration is based on the ASP.NET web application that is created by conducting the procedures in Walkthrough: Creating a Simple Web Application.
For more information, see Analyzing Application Performance by Using Profiling Tools